Skip to content
Home » Sort Items in gallery Power Apps

Sort Items in gallery Power Apps

This Article demonstrate how to sort items in gallery control based on item value. You can sort values either in ascending or descending order.

You can see below app screen, gallery contains employee information such as Employee name, DOJ, Department and Band.



To sort the record in gallery we use the function Sort function.

The Sort function sorts a table based on a formula.

Below is the syntax of sort function.

Sort( Table, Formula [, SortOrder ] )
  • Table – Table name, it is mandatory.
  • Formula – Formula which is evaluated for each record of the table, and the results are used to sort the table. You can reference columns within the table. It is mandatory.
  • SortOrder – Either Descending to sort records in descending or Ascending to sort record in ascending orders. Ascending is the default value.

Let’s sort the records in gallery based on employee Band.

Select the gallery control and go to Items property of gallery as shown below.

Now write the below code that uses Sort functions and sort the records based on employee’s bands in ascending orders.

Sort(
'Employee Info',
Band.Value,
Ascending
)




Once you done with this, you will see gallery items are sorted by Bands.

 

Also Read..

Email Validation in Power Apps

Highlight selected items in gallery

 

 48 total views,  1 views today

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.