PowerApps Alternate Sort Order
Working with PowerApps and Managed Metadata Columns in SharePoint online can be a huge pain. Turns out custom sort order in the Managed Metadata is not supported, but you can force a sort order in your app.
Working with PowerApps and Managed Metadata Columns in SharePoint online can be a huge pain. Turns out custom sort order in the Managed Metadata is not supported, but you can force a sort order in your app.
I have tried several solutions to the apparent issue that Custom Sort Order in Managed Metadata Fields is not supported. Here I have a list of Payment Methods sorted in the Managed Metadata term store using a custom sort order.
Then in SharePoint the order is respected.
Yet, in PowerApps, it is not.
Using the SortByColumns
function you can specify the Choices available to the combobox control items property and sort ascending or descending. I was hoping that there was a hidden attribute of the field that I could use to force the sort, but I couldn’t find one. The typical syntax is to add Ascending
or Descending
for the sort direction.
SortByColumns(Choices('My Data'.PaymentType),"Label",Ascending)
Turns out you can also provide an array of values to force the sort order. For example ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
.
SortByColumns(Choices('My Data'.PaymentType),"Label",["Credit Card","Cash","Check","Paypal"])
Of course this means you have to manage the sort order in two places, so this isn’t a fix so much as a work-around.
Source: [Sort and SortByColumns functions in PowerApps] (https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-sort)
Ready to start your next project with us? That’s great! Give us a call or send us an email and we will get back to you as soon as possible!
+1.512.539.0322