How to: 2nd order sorting

Data type Prompt: Image 2022-10-09 at 6.51.04 AM

  • Prompt has an integer, Order.

Data type Response: Image 2022-10-09 at 6.52.02 AM

  • Response contains a Prompt.

I would like to sort a list of Responses by the Order field in Prompt.

How can I do this?

The Responses are displayed with auto-binding enabled. (So, I have NOT explored using “Copy a list…” on Responses with a recursive workflow.)

(Responses has Many, to One Prompt. So, a trigger-based solution to add/update Order in Response would end up being a very expensive backend operation.)

1 way is just to add a Sort field to the response datatype (integer), and use that for your sorting…

Another way, is to use the ListShifter plugin, which will allow you to sort a datatype by a value on a connected datatype, as explained here:

Sorting according to a Thing’s Thing field - Idea - Bubble Forum

1 Like

It should also be noted with the List Shifter solution: the list can be ANY sortable expression.

1 Like

List Shifter looks great…thanks!

I think this handles my case in a Workflow.

Any way to use this inside an element’s datasource (e.g. “Do a search for…”)?

1 Like

@gaharrington no, unfortunately. There’s no plugin API to the Expression Builder, so we have to use Element plugins that have their own Actions to do this sort of stuff. BTW, in addition to my own explanations of how this works, I’ve seen several different YouTube videos that show how to do these sorts of (see what I did there?) sorts using List Shifter so you might search YT as well.

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