Change Order By for Lists?

Hi, I've tried several different methods and I can't find a way to change the sorting for a filtered list.

The best I could come up with is to change the source for the list. I set the source linked to a variable data cell, then I tried to update the data for that cell. But every time I do, it gives an error.

1 Like

Hi @Nathan maybe this following post: Order By in StackedList could be a way to solve your problem :slight_smile:

1 Like

Thanks so much @Joel-1ada! That's how you can start with a sorted list, but then changing the sort later (on click) has been impossible as far as I can see.

1 Like

Hi @Nathan, welcome to the community and thanks for your question. There are a few different options you can take to achieve this, and I'll share one of the more optimal ways here.

  1. On a screen, have a sort button like below. This button will have an automation set to update a hidden variable, called SortList in my example.

  2. The SortList variable is simply a data cell inside of a content box that has a visibility value of =FALSE (you'll want to keep it hidden from the user(s)). (Data cell visibility value can be set to =TRUE, while the context box is =FALSE)


  3. The key here is the list data source, which leverages an IF statement as the source: =IF($[SortFilter],FILTER(Fruits,"ORDER BY Fruits[Name] ASC"),FILTER(Fruits,"ORDER BY Fruits[Name] DESC"))

Basically, what this does is when a user clicks/taps on the Name button, it sets the SortFilter to True or False, depending on what it's current value is. This ultimately drives the sort type of the list via the IF statement expression (ASC/DESC).

Now here it is in action.

Hope this helps!

cc @Joel-1ada

1 Like

Thanks @aj. The issue is that we have multiple columns that we need to change sorting for. Without being able to change the source, it basically becomes a massive string of if statements. Any other way around this?

Hi @Nathan, I've got another solution for you to try which should address the multiple column scenario you've described. I'll first state though that perhaps this isn't exactly what you're looking for, but hopefully it'll serve a similar purpose (sorting by a variety of columns). :slight_smile: And rest assured that we are actively seeking a better way to dynamically sort and filter lists. In the meantime...

In my test app I have two tables. Inventory and OrderBy.
image

and

image

You'll notice in the OrderBy table there are two columns, one is Order By and the other is Inventory. The latter, Inventory, has the following expression pattern. =Filter(Inventory,"ORDER BY Inventory[Name]") and =Filter(Inventory,"ORDER BY Inventory[Name] DESC") for example.
2020-07-21_16-43-48 (1)

Basically this table will contain all of the sort types you would like to present to the user. Likely each column will have an ASC and DESC expression, one per row.

Now here's my app in builder.

I use a Rowlink/picklist that the user can select which type of sort they want to use, and this is the OrderBySelection variable. This Rowlink references the OrderBy table from above.

Next is a hidden content box (visibility =FALSE) named OrderBy. It has the following expression and properties. =IF($[OrderBySelection]="",Findrow(OrderBy),$[OrderBySelection])

Lastly, my list source is as follows. =$[OrderBy][Inventory]

Now let's see it in action.

Now granted it's not as simple as other lists where you just click the column header to sort, however, this should still achieve the same goal.

Let us know how this goes for you!

Yeah, that's definitely not ideal. What we really need is basically an embed of the data that allows end users to filter and sort like the spread does. Sadly, I think we are going to have to either wait till HoneyCode is more mature or find another solution.

Sounds good @Nathan. I'd encourage you to take a look at the Customer Tracker template as well, as this has both sorting like above as well as filtering of a list. It's a pretty robust combination of both. E.g.

As we make improvements in this space, we will definitely keep you and the rest of the community posted! Thanks for the feedback.

A post was split to a new topic: Sort a list by clicking on the heading name

hi @Nathan, it's been a while. :slight_smile: Just wanted to make sure you saw this: Honeycode Buzz - Builder & Table Enhancements, Single Sign-On Functionality for Business Users, and Introducing Team Settings. Specifically, the new functionality that allows app users to sort/filter columns.