cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Dual Super User III
Dual Super User III

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
Highlighted
Dual Super User III
Dual Super User III

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.
Highlighted
Anonymous
Not applicable

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.

Highlighted
Dual Super User III
Dual Super User III

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

Highlighted
Dual Super User III
Dual Super User III

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (12,539)