cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Patron
Post Patron

Create multiple sorting icons for single gallery

Hello,

 

I have added an icon for sorting a gallery by column "SortByColumns" but want to add another for another column but having trouble with the formula. Below is what I have so far. How would I add the second "SortByColumns" for second icon?

 

I would like to add another icon for "SortByColumns" for "Customer".

 

SortByColumns(Filter(Search(LIST01, SearchBox.Text, "E_x002d_mail", "Customer", "LISTRMA_x0023_", "Contact"), If(Dropdown1.Selected.Value = "All", true, Status.Value = Dropdown1.Selected.Value), If(Dropdown2.Selected.Value = "All", true, Branch.Value = Dropdown2.Selected.Value)), "LISTRMA_x0023_", If(SortDescending1, Descending, Ascending))

 

Thanks in advance.

6 REPLIES 6
Super User III
Super User III

Hi @ShadowTech ,

If you set the second icon to toggle

UpdateContext({SortDescending2:!SortDescending2})

you could do this

SortByColumns(
   Filter(
      Search(
         LIST01, 
         SearchBox.Text, 
         "E_x002d_mail", 
         "Customer", 
         "LISTRMA_x0023_", 
         "Contact"
      ), 
      If(
         Dropdown1.Selected.Value = "All", 
         true, 
         Status.Value = Dropdown1.Selected.Value
      ), 
      If(
         Dropdown2.Selected.Value = "All", 
         true, 
         Branch.Value = Dropdown2.Selected.Value
      )
   ), 
   "LISTRMA_x0023_", 
   If(
      SortDescending1, 
      Descending, 
      Ascending
   ),
   "Customer",
   If(
      SortDescending2, 
      Descending, 
      Ascending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

@WarrenBelz 

 

Tried that same implementation but for some reason the second sort button does not execute that function. Nothing happens when clicking the second sort button. Just the first sort button works.

 

Any ideas?

 

Thanks.

Hi @ShadowTech ,

Strange, but I have not tried that before, so try this

Sort(
   Sort(
      Filter(
         Search(
            LIST01, 
            SearchBox.Text, 
            "E_x002d_mail", 
            "Customer", 
            "LISTRMA_x0023_", 
            "Contact"
         ), 
         If(
            Dropdown1.Selected.Value = "All", 
            true, 
            Status.Value = Dropdown1.Selected.Value
         ), 
         If(
            Dropdown2.Selected.Value = "All", 
            true, 
            Branch.Value = Dropdown2.Selected.Value
         )
      ), 
      LISTRMA_x0023_, 
      If(
         SortDescending1, 
         Descending, 
         Ascending
      )
   ),
   Customer,
   If(
      SortDescending2, 
      Descending, 
      Ascending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz Yeah that doesn't work. Using "SortByColumns(SortByColumns(" doesn't work either.

@ShadowTech ,

The syntax structure should be valid - what do you mean by "it does not work" - does the code produce an error?

Also note that this will sort by LISTRMA_x0023_ and then Customer - do want to sort by one or the other ? If so you need another structure with a value (say radio control) with Items ["Customer", "ListRMA"] and would look something like this (and you can go with a single sort button).

Sort(
   Filter(
      Search(
         LIST01, 
         SearchBox.Text, 
         "E_x002d_mail", 
         "Customer", 
         "LISTRMA_x0023_", 
         "Contact"
      ), 
      If(
         Dropdown1.Selected.Value = "All", 
         true, 
         Status.Value = Dropdown1.Selected.Value
      ) &&
      If(
         Dropdown2.Selected.Value = "All", 
         true, 
         Branch.Value = Dropdown2.Selected.Value
      )
    ), 
   If(
      YourRadio.Selected.Value="Customer",
      Customer, 
      LISTRMA_x0023_
   ), 
   If(
      SortDescending1, 
      Descending, 
      Ascending
   )
)

 Please note all of this is free-typed, so watch commas and brackets etc.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @ShadowTech ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (92,648)