cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Sorting gallery by boolean value

I'd like to sort my gallery by boolean value, which is possible, but I'd like false/null values to appear first. Currently the sort function results in true values appearing first regardless of ascending or descending sort order.

 

Does anyone know how to get false/null values to appear first instead?

1 ACCEPTED SOLUTION

Accepted Solutions

I'd suggest creating a new column that groups everything into true or false then sort that. 

 

SortByColumn(AddColumn( DataSource, ColumnName, if(blah.text = true, true,false)),ColumnName,Ascending)

 

It'd look something like this

View solution in original post

5 REPLIES 5
Microsoft
Microsoft

@tnw 

 

Could you please try using SortByColumns() formula with this you will be able to sort data based on column which will enable you to see the false and null values. 

 

Also could you please try re-configuring the formula once, I also tried using the sort() formula and I was able to see the values 

Please check the reference document for more insights regarding the same.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-sort

 

If this information helps you with resolution, please consider giving a thumbs up and mark the solution as resolved.

Super User III
Super User III

Wrap the formula with sort Example

Sort(Filter( Customers, Column in SortColumn),TrueFalseColumn,Ascending)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

This does sort so that false values appear first but null values appear last. I would like false and null to appear before true values.

I'd suggest creating a new column that groups everything into true or false then sort that. 

 

SortByColumn(AddColumn( DataSource, ColumnName, if(blah.text = true, true,false)),ColumnName,Ascending)

 

It'd look something like this

View solution in original post

Use  Addcolumns to create a collection:

ClearCollect(MyTable2,AddColumns(DataSource,"SortColumn",If(TrueFalseColumn="False",1,2)))
 
This makes all false 1 and all others wether true or Null 2
 

Then sort as:

Sort(MyTable2,SortColumn,Ascending)
 
Or
Sort(MyTable2,SortColumn,Descending)
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (70,071)