web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Dropdown control for a...
Power Apps
Unanswered

Dropdown control for a gallery

(0) ShareShare
ReportReport
Posted on by 50

I am attempting to control what is displayed in a gallery with two drop downs.  Currently it works fine but will only select a gallery item on every other drop down change.  For example, Auditor dd and Review Status dd,  When I select an auditor, the gallery filters and sorts as expected and selects the first item in the gallery, if I change the auditor or the review status, the gallery sorts and filters correctly but does not select the first gallery item, if I change a dd again, the first gallery item is selected.  I need the gallery to select a gallery item every time a dd is changed. 

Categories:
  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Hello,

    Can I see your filter code please? I may be able to shed some light on the subject.

     

    Kyle

  • sfcmartint1985 Profile Picture
    50 on at

    Sure thing, thanks so much!  

     

    SortByColumns(

    //Returns all items when both dropdowns are set to All

    If(ddAuditorAssigned_1.Selected.Value = "All" And ddReviewStatus1.Selected.Value = "All", Review_of_Accuracy_of_TDIU_Claims_Grants,

    //Returns review status selection when auditor is set to all.

    ddAuditorAssigned_1.Selected.Value = "All" And ddReviewStatus1.Selected.Value <> "All",

    Filter(Review_of_Accuracy_of_TDIU_Claims_Grants, 'Review Status' = ddReviewStatus1.Selected.Value),

    //Returns results when review is set to all and auditor is selected to a specific auditor

    ddAuditorAssigned_1.Selected.Value <> "All" And ddReviewStatus1.Selected.Value = "All",

    Filter(Review_of_Accuracy_of_TDIU_Claims_Grants, Reviewer = ddAuditorAssigned_1.Selected.Value),

    //default behavior, returns auditor and review status

    Sort(Filter(Review_of_Accuracy_of_TDIU_Claims_Grants, Reviewer = ddAuditorAssigned_1.Selected.Value And 'Review Status' = ddReviewStatus1.Selected.Value), Name, SortOrder.Descending)),

     

    //Sorts in ascending order on status.

    "Review_x0020_Status", SortOrder.Descending

    )

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Ok, so at first glance let's change all "And" to "&&"

     

    Code should look like this:

    SortByColumns(
     //Returns all items when both dropdowns are set to All
     If(
     ddAuditorAssigned_1.Selected.Value = "All" && ddReviewStatus1.Selected.Value = "All", 
     Review_of_Accuracy_of_TDIU_Claims_Grants,
     //Returns review status selection when auditor is set to all.
     ddAuditorAssigned_1.Selected.Value = "All" && ddReviewStatus1.Selected.Value <> "All",
     Filter(
     Review_of_Accuracy_of_TDIU_Claims_Grants, 'Review Status' = ddReviewStatus1.Selected.Value
     ),
     //Returns results when review is set to all and auditor is selected to a specific auditor
     ddAuditorAssigned_1.Selected.Value <> "All" && ddReviewStatus1.Selected.Value = "All",
     Filter(
     Review_of_Accuracy_of_TDIU_Claims_Grants, Reviewer = ddAuditorAssigned_1.Selected.Value
     ),
     //default behavior, returns auditor and review status
     Sort(
     Filter(
     Review_of_Accuracy_of_TDIU_Claims_Grants,
     Reviewer = ddAuditorAssigned_1.Selected.Value && 'Review Status' = ddReviewStatus1.Selected.Value
     ),
     Name,
     SortOrder.Descending
     )
     ),
     //Sorts in ascending order on status.
     "Review_x0020_Status", SortOrder.Descending
    )

     

    There maybe an easier way to write this, give me a few minutes. Hahaha

     

    Kyle

  • sfcmartint1985 Profile Picture
    50 on at

    Ok thanks, changing to && made no difference. 

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Ok, lets try this:

    SortByColumns(
     //Returns all items when both dropdowns are set to All
     Filter(
     Review_of_Accuracy_of_TDIU_Claims_Grants,
     (ddReviewStatus1.Selected.Value = "All" || 'Review Status' = ddReviewStatus1.Selected.Value),
     (ddAuditorAssigned_1.Selected.Value = "All" || Reviewer = ddAuditorAssigned_1.Selected.Value)
     ),
     //Sorts in ascending order on status.
     "Review_x0020_Status", SortOrder.Descending
    )

     

    Kyle

  • sfcmartint1985 Profile Picture
    50 on at

    Firstly..THANK YOU, much easier way to write the formula.  Secondly...it still does not work.  Only selects a gallery item on every other change. 

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Try adding First() around the entire script?

     

    First(
    SortByColumns(
     //Returns all items when both dropdowns are set to All
     Filter(
     Review_of_Accuracy_of_TDIU_Claims_Grants,
     (ddReviewStatus1.Selected.Value = "All" || 'Review Status' = ddReviewStatus1.Selected.Value),
     (ddAuditorAssigned_1.Selected.Value = "All" || Reviewer = ddAuditorAssigned_1.Selected.Value)
     ),
     //Sorts in ascending order on status.
     "Review_x0020_Status", SortOrder.Descending
    )
    )
  • sfcmartint1985 Profile Picture
    50 on at

    Good suggestion but it only returns the first item in the gallery then, not all of them. 

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Crap! I also tried putting First(Self.AllItems) in a gallery but then you can't select anything else! lol 

  • sfcmartint1985 Profile Picture
    50 on at

    this is getting frustrating.  Should be an easy fix...but noooo. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard