How to Sort in Descending via formula

I feel like I’m missing something obvious here. I’m trying to bind the sort formula to be ascending and descending based on the selected value. When it’s not binded, the descending works fine. When binded, I can’t find the string that makes the descending sort work. It ALWAYS sorts in ascending order despite the value it is binded to. I can’t find any documentation on it or any syntax in the mozilla js docs, because they use sort() and reverse(), not a string value of ‘asc’ or desc’. I’ve tried all of the following values with no luck.

‘dsc’, ‘Dsc’
‘desc’, ‘Desc’
‘descending’, ‘Descending’
‘descend’, ‘Descend’
‘reverse’, ‘Reverse’

This page would make it seem like ‘descending’ is the right value.

Appreciate the help

2 Likes

Have you tried DESC?

3 Likes

Wow I would not have guessed all caps :man_facepalming:

That worked, thank you man!

1 Like

Incredible. I was trying to resolve this for at least 1 hour…just read this solution! thanks.

2 Likes

I’m embarrassed it took me this long to turn to the community for this. For the longest time I was using formula-based sorting, eg sort(collection, key, order) because I had just assumed that the UI-based sorting was for some other usecase since it wasn’t working as expected. Well, after running into problems with the table loading more than 200 rows, I had to figure something out and revisited the UI-based sorting.

Only then did I discover this thread which immediately solved things. It’s interesting that to sort ascending, “asc” works just fine, but to sort descending one has to enter “DESC” in all caps, especially when the UI suggests “Asc” and “Desc.” This really feels like it should be resolved once and for all.