Hello, i have an app made with a gallery, a search bar and a sort icon.
The gallery is loaded with a SharePoint connector.
The sharepoint list has a Person Type column called User.
The gallery shows names and surname using User.DisplayName.
I'd like to be able to click on the sort icon and have the gallery sorted by the name or surname of the user.
how can i do that? i read that sortbycolumn function doesn't work with special columns.
Solved! Go to Solution.
Hi @Antonioclk ,
One of the (many) reasons I do not use Person columns - this is not Delegable (nor can you make it so)
Sort(
AddColumns(
SPList,
"PersonSort",
YourPersonColumn.DisplayName
),
PersonSort,
If(
SortDescending,
Descending,
Ascending
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi @Antonioclk ,
One of the (many) reasons I do not use Person columns - this is not Delegable (nor can you make it so)
Sort(
AddColumns(
SPList,
"PersonSort",
YourPersonColumn.DisplayName
),
PersonSort,
If(
SortDescending,
Descending,
Ascending
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Thank you so much, i tried exactly this but when i click on the filter icon it does nothing, like it wasn't linked with the gallery... how can it be?
the code is written in the onSelect property of the icon. should i wrap it into an UpdateContext?
Your blog is very interested, i favorited it 😉
Hi @Antonioclk ,
Neither, the code would be used for the Items of a Gallery, Drop-down or Combo Box.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
oh ok, and how can i reverse the order (ascending, descending) by clicking on the icon?
i wrote this in my gallery Items property
Filter(
Search(
AddColumns(
MyData,
"UserName",
User.DisplayName
),
SearchBar.Text,
"UserName", "Phone"
),
If(
IsEmpty(sportList.SelectedItems),
true,
Sport in sportList.SelectedItems
),
If(SortDescending, Descending, Ascending))
)
and in the sort icon onSelect i wrote
UpdateContext({SortDescending: !SortDescending})
but it's not working, when i click the icon it doesnt happen anything
Please see update post.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
User | Count |
---|---|
252 | |
104 | |
94 | |
50 | |
39 |