cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Sortbycolumns on a Gallery from a dropdown SharePoint list

Hi guys,

 

I'm having an issue on my app. I can't filter my gallery on a column because my data is a dropdown list on a SharePoint list, does anyone know how I should write this formula correctly?

 

SortByColumns(Filter(Communications;Type_comm.Value=NameComm.Text);"Statut")

 

Here is my Gallery I would like to sort on "Statut".

Capture.PNG

Thank you in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Sortbycolumns on a Gallery from a dropdown SharePoint list

You can't sort by a choice column directly because you have to sort by the value property of the column, not the column itself.  YOur only other choice would be to use Sort() instead of SortbyColumn.  Taht way you can access Statut.Choice for the Sort formula.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
Dual Super User
Dual Super User

Re: Sortbycolumns on a Gallery from a dropdown SharePoint list

The problem is that dropdowns, I will assume this is a choice column, have a complex object as a value. But Sortbycolumns is looking for a simple text or number value.  The solution is to use AddColumn to add the simple value of the choice column to a new column and then sort the results by that.  Something like this.

SortByColumns(AddColumns(Filter(Communications;Type_comm.Value=NameComm.Text);"SortCol";Statut.Value),"SortCol")


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Anonymous
Not applicable

Re: Sortbycolumns on a Gallery from a dropdown SharePoint list

Thank you for your help, but I do not want to add any columns haha I just want to filter my actual SharePoint list, and keep my column "Statut" as a choice and not turn it into a text column if it is possible.

Dual Super User
Dual Super User

Re: Sortbycolumns on a Gallery from a dropdown SharePoint list

You can't sort by a choice column directly because you have to sort by the value property of the column, not the column itself.  YOur only other choice would be to use Sort() instead of SortbyColumn.  Taht way you can access Statut.Choice for the Sort formula.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Dual Super User
Dual Super User

Re: Sortbycolumns on a Gallery from a dropdown SharePoint list

I should also mention taht AddColumn doesn't change the "statut" column it simply adds another column to the table under the name you specify and uses that for Sorting.  The original "statut" column will still be available also.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,808)