How to sort a list in a state?

Hello,

I’m trying to sort a list that is in a state, based on a sorting priority saved in the database. Each row in my database has an s3 file address url and a sorting priority ( 1, 2, 3…)

When I’m adding items to my list, there isn’t a guarantee that the user will click the items in the right order. If they don’t click the right order, the api will generate a pdf in the wrong sequence.

So I’m trying to figure out how to reorder a list prior to initiating my api call.

Any ideas would be helpful. Thanks.

Take whatever list they create when they click in any order they want and create a new list with it, and on saving that new list, sort it according to the sorting priority and use that new list as the list to create the pdf with

That part I have figured out, but I can’t figure out how to sort it based on a database search. I have it going through another repeating group right now and I can get most of the functionality, but it relies on a plugin and is very awkward. I am sure there is an easier way. Is there any way to do a list array?

yes, but I am not familiar with list array as that is something from coding and I am a non-coder. I do know how to use bubble fairly well and doing what I mentioned about allowing the user to create the list in any order they wish and then creating a second list using the same items the user added to the first list will work to do what you are wanting to

Think about it: if I create a list as a user and I select 6 out 50 items in any random order that I want the list could have things in this order ( using item sort order number for illustration )

5
12
9
2
33
45

In that order you have an issue which is the first item in the list is sort order #5. So how do you get it to be in position number 5, or at least come after item with sort order #2?

Save a new list, using those same exact items and when saving that new list sort them into the order they would go

R.G. 1 is first list

R.G. 2 is second list

After R.G. 1 is saved, run a workflow to set the list into R.G. 2 and sort it.

Then send the R.G. 2 list to the API

Simple.

If you take the time to put sort order as a data field onto the data type you are working with it helps for a lot of things. Especially when trying to match items to a particular order. Also because repeating groups have an index which is basically sort order on the R.G. I use the matching of those numbers quite frequently to sort things before sending them to an API workflow.

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