In PowerApps, we can use the SortByColumn functions to sort the Items/Table by specific column.
We will run how to sort the table by specific column On button click.
- I have a sample Product SampleData excel sheet with below columns, which is hosted on OneDrive business.
- I have already created a basic PowerApp with Products Sample Data
- Add the Sort icon from Icons on the header, where I added the UpdateContext formula against the onSelect property, which create a context variable for current screen.
1UpdateContext({SortByOrder:!SortByOrder})
- Added the Products item in Gallery view, where I added the SortByColumns formula against the Items property and Sorting by “Item” column. We can sort items with multiple columns like
ClearCollect( SortByQuantity, SortByColumns( Table1, “Item”, Ascending, “Total”, Descending ) )
123456//FORMULASortByColumns( Table, ColumnName, SortOrderTable )//ImplementationSortByColumns(Table1, "Item", If(SortByOrder, Descending, Ascending)) - Now run the App, you will in Ascending order (SortOrder.Ascending is the default), now Click on the Sort Icon it will sort item by Decreasing order. See below screenshot
I hope this helpscand you understood how to use SortByColumn in Microsoft PowerApps and how to run it.