Sort, SortByCoulmn Along With Filter Functions Used In Microsoft PowerApps Gallery

Introduction


In this article, I am going to explain how the Sort and SortByCoulmn Functions are used in Microsoft PowerApps, and also how to filter the data source with a logical condition.
 
Step 1
 
Let us consider my previous article (“Steps to connect SharePoint List using Power Apps”) in which I have created a Share Point List as Registration Form. By using that SharePoint List as a data source, we learned how to create a Form using Microsoft PowerApps.
 
Step 2
 
There will be three screens in the left pane or Tree view, “Browse Screen”, “Detail Screen”, “Edit Screen”. We can display the data of Share Point List by using Microsoft PowerApps.
 
Step 3
 
Select Browse Screen and click on Browse Gallery1 and Edit Fields on the right pane of the screen. Add the required fields as displayed.
 
Sort, SortByCoulmn Along With Filter Functions Used In Microsoft PowerApps Gallery
 
The image here shows the browse gallery, which is sorted by the default Power Apps Formula displayed in the below picture.
 
Sort, SortByCoulmn Along With Filter Functions Used In Microsoft PowerApps Gallery
 
Step 4
 
Now you will look into various examples of how to display the data in Microsoft Power Apps Gallery by using Sort, SortbyColumn function using appropriate PowerApps formula, according to our requirement.
 
Syntax
 
Sort( DataSource, Formula [, SortOrder ] )
 
Explanation
 
Sort-Keyword
Data Source-SP List Name
Formula- We apply formula (If you search more than one column)
SortOrder-Either Ascending(SortOrder.Ascending) /Decending(SortOrder.Descending)
 

Example 1 - Sort by Registration Date

 
Step 1
 
Choose the gallery and set its Item property with this formula to sort according to Registration Date.
  1. Sort('Registration Form',RegistrationDate,Ascending)    
Sort, SortByCoulmn Along With Filter Functions Used In Microsoft PowerApps Gallery
 
The above image displays the Gallery. The Data in the Gallery are sorted in ascending order as per the student registration date.
 

Example 2 - Sort by Registration Date, Filter by the Course Name

 
Select Items property of the Gallery and use the formula below,
  1. Sort(Filter('Registration Form',Course.Value="Power Apps"),RegistrationDate)   
Sort, SortByCoulmn Along With Filter Functions Used In Microsoft PowerApps Gallery
 

Example 3 - SortbyColumns by column “Title,”  Filter by the Course Name

 
Select Items property of the Gallery and use the formula below,
  1. SortByColumns(Filter([@'Registration Form'],Course.Value="Share Point Online"), "Title", Descending)    
Sort, SortByCoulmn Along With Filter Functions Used In Microsoft PowerApps Gallery
 

Example 4 - SortbyColumns by column “Title”, Filter by the First Letter of the Student’s Name

 
Select Items property of the Gallery and use the formula below,
  1. SortByColumns(Filter([@'Registration Form'], StartsWith(StudentName, "S")),"RegistrationDate", Descending)  
Sort, SortByCoulmn Along With Filter Functions Used In Microsoft PowerApps Gallery
 

Summary

 
In this article, we learned how to display data in Microsoft PowerApps Gallery by using Sort and SortbyColumn and filter with logical conditions.
 
Before reading this article, please go through the article below,
 
I hope you enjoyed having a hands-on with these example by using Sort/SortbyColumns with Filter in Microsoft PowerApps Gallery.


Similar Articles