Sorting a SharePoint Cascading dropdown in PowerApps.

 

Simple sort function in Power App has the definition of Sort(Source, Expression, SortOption)


i recently got a chance to work on using sort in a cascading dropdown. Nothing fancy in this its just you have always seen sort used with filter function in conjunction. But when you use it for a cascading dropdown you need to deal with one extra For All loop. 

So your snippet looks something like below.

ForAll(

    Sort(Filter(

        BusinessUnits,// SharePoint list with all cities 

        Division.Value = ddDivision.Selected.Value

    ),Title,Ascending),

    {

        Value: Title,

        // Create a new item with Value/Id, which will save correct 

        Id: ID// It's important to have Value as the first field! 

    }

)


Remember sorting is done via the Title column and not the Division column. 


Also, a bonus tip in order to change the format of dates in power app, All your dates have a format property you can use to change the format of date.


Comments

Popular posts from this blog

Creating Nested Galleries in Power Apps. (Parent-Child Relationship)

How to reset a datepicker control in PowerApps?

Reset () function failing to work on Edit form for Combo boxes in Power App.