Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

Sort Gallery 'YES' on Top

(0) ShareShare
ReportReport
Posted on by 12
I have Gallery_1.

I have CheckBox_1.

A client can one or multiple addresses. The checkbox
indicates which address is the client's active address.

How do I edit my formula sort so that the 'Yes' item
in  group of client items is on top.

I do not want all 'Yes' to appear on top by default, only
when the client is selected and has more than one address.

The system is set-up so that a client can have only one
active address.

Gallery Items -
If(!IsBlank(ComboBox1.Selected.DisplayValue),
Filter(Subscriber_Address_Collection,Title in
ComboBox1.Selected.DisplayValue),Subscriber_Address_Collection)


  • Suggested answer
    CD-20090208-0 Profile Picture
    12 on at
    Sort Gallery 'YES' on Top
    FInally got!
     
    Thank you!!
     
    If(!IsBlank(ComboBox1.Selected.DisplayValue),
    Sort(Filter(Subscriber_Address_Collection,Title in ComboBox1.Selected.Name),
    Active_Address = "true",SortOrder.Descending),Subscriber_Address_Collection)
  • ronaldwalcott Profile Picture
    2,427 on at
    Sort Gallery 'YES' on Top
    What are you sorting on?
    The sort statement is Sort( Table, Formula [, SortOrder ] )
     
    and the Table is your Filter statement but I don't see the Formula component.
    You have not provided the data models and the corresponding controls so its impossible to explicitly state the values that should be used in the sort.
    I suggested that the format should be something like
    Sort(Filter(Subscriber_Address_Collection,Title in ComboBox1.Selected.DisplayValue),theCheckBox.Value,SortOrder.Descending)
    but you have to identify what theCheckBox.Value is.
    I am assuming that it produces Y or N; Yes or No therefore producing the sort order which you require,
     
  • CD-20090208-0 Profile Picture
    12 on at
    Sort Gallery 'YES' on Top
    I just tried this, which shows the 'YES' checkbox, but no other information, and I am getting a 'circular reference' error.

     
    Same with just the Checkbox in the formula. Same error.
  • ronaldwalcott Profile Picture
    2,427 on at
    Sort Gallery 'YES' on Top
    Should be something like that. Not the exact references as I don't know what they are,
     
    If(!IsBlank(ComboBox1.Selected.DisplayValue),
    Sort(Filter(Subscriber_Address_Collection,Title in ComboBox1.Selected.DisplayValue),theCheckBox.Value,SortOrder.Descending),
    Subscriber_Address_Collection)
     
     
    The sort only acts on the filtered portion. I don't understand your requirements regarding the complete list I am assuming the combox box selects the addresses associated with one entity. 
  • Michael E. Gernaey Profile Picture
    39,785 Super User 2025 Season 1 on at
    Sort Gallery 'YES' on Top
     
    If I look at your expressions they are not valid as the if statement only has 1 side the true, not the false. It has to have both sides.
     
    My guess is you hover over it will tell you this, heck you might have other errors, but thats one of them.
     
    if(x, true, false)
     
    not
     
    if(x, true)
     
  • CD-20090208-0 Profile Picture
    12 on at
    Sort Gallery 'YES' on Top
    Yes, I did. I got errors.

    Tried it with the SP List column (Active_Address) -
     
     
    Tried it with the Gallery Checkbox -
  • ronaldwalcott Profile Picture
    2,427 on at
    Sort Gallery 'YES' on Top
    Did you try adding the sort?
  • CD-20090208-0 Profile Picture
    12 on at
    Sort Gallery 'YES' on Top
    It is a Gallery filtered by a Dropdown.

    The user can select a client from the Dropdown.

    The Gallery is currently filted by -
    If(!IsBlank(ComboBox1.Selected.DisplayValue),Filter(Subscriber_Address_Collection,Title in ComboBox1.Selected.DisplayValue),Subscriber_Address_Collection)

    If the Dropdown is blank the Gallery is filtered A - Z, by name.

    If a selection is made the Gallery only shows items associated with that name.

    The example shows a group of address associated with my name. The active address (green check mark) appears at the bottom of the gallery. I'd like it to appear at the top of the Gallery.

     
  • Michael E. Gernaey Profile Picture
    39,785 Super User 2025 Season 1 on at
    Sort Gallery 'YES' on Top
     
    You said
     
    I do not want all 'Yes' to appear on top by default, only
    when the client is selected and has more than one address.
     
    but did not explain what this means, not explained what data is loaded into, whatever we are looking at.
     
    What data is listed, is it only one client that you selected, is it lots and you are selecting from the Gallery.
     
    Please give more clarity as remember, we don't know your app or business logic or data so please spell it out clearly.
     
    CHeers
  • CD-20090208-0 Profile Picture
    12 on at
    Sort Gallery 'YES' on Top
    What is/do you mean by data structure?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,518 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,756 Most Valuable Professional

Leaderboard