Sort a repeating group on the nth element of a list variable

Hello all,
I’m trying to sort a repeating group on the nth element of a list variable. List variables don’t seem to be available from the “sort by” box in the search dialogue. I tried using List Shifter, which at least lets me access list variables, but when I try to indicate which element to sort on, Bubble turns it red and tells me that the results is a single number rather than a list.

Any hacks appreciated. Bonus points if you can tell me the obvious thing that I’m missing. Thanks!

Filtering is different than sorting. The topic of the post and first sentence says filter but then you proceed into talking about sorting with a screen capture of sorting. Maybe it is clear to others but I’m presently uncertain if your question is in reference to filtering sorting or both.

Ugh. That’s super embarrassing. I fixed the title to reflect my intent. Thanks!

I am not familiar enough with the ListShifter plugin (other then I know it’s a good plugin from a good author), but just using what Bubble provides, they offer a dynamic sort field. Keep in mind sorting is based on a field name in Bubble i.e sort Months by MonthNumber (where Months is a Data Type and MonthNumber is a field on the Months Data Type).

A dynamic sort field implies that the value you are providing is some field that exists on a DataType. It’s not completely clear to me based on the wording of your question if you are looking for this or something different.

Here is an example:

Data Types defined as follows:

I eventually solved this by passing a custom state to List Shifter. When creating a custom state you are able to make a list from the nth value from each list in a list of lists. I was then able to pass this custom state list to List Shifter, which then sorted the list.
Hopefully this helps someone else.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.