I have a custom state that contains a list of things, by clicking the save button, I need to add each object in the custom state to a table.
that table expects two fields,: status, and student,
my custom state has a list of students, I need to add one entry to the database for each student in it.
Hi there, @shawqi.jw… you can do what you described by using a backend workflow that takes a list of students as its parameter (you will pass the custom state’s list of students to the backend workflow when the save button is clicked). The first step in the backend workflow creates a new thing in the appropriate data type, and it sets the student for that thing equal to the first item in the student list (it also sets the status to a value, but you didn’t mention how that value is determined). The second step in the workflow calls the backend workflow again, and it sends the student list parameter as the student list minus (minus item) the result of step 1’s student. The second step also has a condition on it that runs the step only when the student list count is greater than 0.
Hope this helps.
Best…
Mike
And if you’re on a free plan that doesn’t have access to the backend workflows, you can get the List Shifter plugin and execute a workflow on each item in a repeating group. I don’t like doing that stuff because if a user closes out of the browser early then the workflow never gets completed, vs doing what @mikeloc suggested in the backend is much more reliable
You can also check out List Popper in myList Popper and Friends plugin if you have access to backend workflows. Makes recursive backend workflows much easier. (Though note that 90% of what Bubblers use that for is just crap that would be easier to do in code in the front end. Whaddyagonnado?)
Thanks,
for the status _ will set a default value,
I am on a free version, but have no problem upgrading to a paid one!
is the backend workflow differ from that regular workflow ?!
also, I still do not understand how can I make an iteration to insert each and every student in my list
, how can I make the loop from the first team to the last one?