How to order the results of select expression

I’ve been studying the documentation and searching this community for information about how to order the results of a select expression by a separate column.

My app has an action that writes a list of words that have been studied recently. That is done with a select expression. Today, I thought it might be good to sort the order of those words by the number of times they have been studied (another column).

I know how to use ORDERBY to get a list of keys. I also know how to use SORT to order the list of words alphabetically. But, neither of those is exactly what I want to do now. Is there a good way to make a list of words (a column that is not a key) that is sorted according to another column? If, for example, I use ORDERBY with SELECT to get a list of the keys in the right order, can I convert that list of keys into a list of the “words” in the rows identified by the keys?

By the way, the number of words picked up by my current SELECT expression varies and the list can be moderately long, so using INDEX doesn’t seem like a very practical solution for me.


Would making the count(studied) a VC then sorting in a view be viable? I don’t believe you could achieve this functionality in an expression.


Thanks for the quick reply. If it can’t be done in a single expression perhaps I should give up. I was hoping to be able to do it inside a single expression (inside the action). I wonder, too, if the order of a view would affect the order in which things are written in an action. A slice can be invoked in an action but I didn’t think the order of the slice would be affected by the order in a view, would it?

The only way is generate a list of row references in the desired order, store that list in a column, then dereference that list to get the desired column values. Provide more table details for an example.


If you dereference on a list you get the list of dereferenced values?

1 Like



There’s my new thing learned for the day. Time to go home :exploding_head:


It took me a while to respond because I didn’t understand the meaning of “dereference.” The documentation helped.

My idea to reorder the list was an afterthought that really isn’t very important. Since I can’t do it in a single expression, it sounds like it might be somewhat costly both in terms of what I would need to add to my app (potential for making the app heavier) and the time it would take to implement this.

So, since I’ve learned that I can’t do this inside a single expression, I think I’ll give up and leave my app as it is. Thanks for the help.