cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How do I use sort button to sort my data by version?

Hi all, I want to add a button to sort my data, I wish it can sort by the version ascending/decreasing.

DHsieh22_0-1641461070686.png

 

The grammar of my data gallery as below:

DHsieh22_1-1641461248133.png

 

I don't know how to add the grammar to the button & data gallery...please help...

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Anonymous ,

A bit more compact with the original syntax I posted

Sort(
   Filter(
      FIT,
      StartsWith('Matrix Version',TextInput1.Text) &&
      (Dropdown1.Selected.Result = Blank() || Title = Dropdown1.Selected.Result)
   ),
   'Matrix Version',
   If(
      varsort,
      Ascending,
      Descending
   )
)

 

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.

Visit my blog Practical Power Apps

View solution in original post

6 REPLIES 6
WarrenBelz
Super User
Super User

Hi @Anonymous ,

Try this

Sort(
   Filter(
      FIT,
      StartsWith(
         'Matrix Version',
         TextInput1.Text
      ) && 
      (
         Dropdown1.Selected.Result = Blank() || 
         Title = Dropdown1.Selected.Result
      )
   ),
   Version      
)

 

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.

Visit my blog Practical Power Apps

WarrenBelz
Super User
Super User

Hi @Anonymous ,

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.

Visit my blog Practical Power Apps

Anonymous
Not applicable

Hi @WarrenBelz ,

 

Sorry for my late reply & thanks for your help.

I'm new to power apps and I have no programming experience... so I'm still work on this problem.

I don't know why there is some errors after use your grammar, and how to use the button? Should I add grammar to the button?

 

Anonymous
Not applicable

I found the solution! This can be work:

Sort(If(Dropdown1.Selected.Result = Blank(),Filter(FIT,StartsWith('Matrix Version',TextInput1.Text)),
Filter(FIT, Title = Dropdown1.Selected.Result And StartsWith('Matrix Version',TextInput1.Text))),'Matrix Version',If(varsort,Ascending,Descending))

 

and the button use this, OnSelect:

UpdateContext({varsort:!varsort})

 

Hi @Anonymous ,

That code is for the Items of a gallery.

@Anonymous ,

A bit more compact with the original syntax I posted

Sort(
   Filter(
      FIT,
      StartsWith('Matrix Version',TextInput1.Text) &&
      (Dropdown1.Selected.Result = Blank() || Title = Dropdown1.Selected.Result)
   ),
   'Matrix Version',
   If(
      varsort,
      Ascending,
      Descending
   )
)

 

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.

Visit my blog Practical Power Apps

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,156)