I want to create multiple rows of thing with one button click

Hi bubblers. i have created a list in a custom state and now want to create a bubble thing such that each item in the custom state list will be added as a separate row in the table. I need help on how to do this in bubble. Looking forward to your help.

I can try to help you but I need you to elaborate a bit more. You want to add it as a separate row in what table?

Hi there, @abdullahi.alfa… having the clarification that @thekeybeats2 mentioned would probably help, but regardless of the answer (unless you want to “create” users), you are likely going to need to use a recursive backend workflow to do what you described.

The above being said, create a backend workflow that takes a list that is the same type as your custom state list. Add an action to the workflow that creates a new thing in a custom data type using the first item in the custom state list to populate a field in the data type. Add a second action to the workflow that calls the same backend workflow again, and pass the same custom state list minus the first item in the list. Finally, add a condition to the second action so the action runs only when the count of the custom state list minus the first item in the list is greater than 0.

Oh, and for what it’s worth, someone might mention that recursive backend workflows could end up being “expensive” when it comes to the new pricing model with workload units… so, that someone might as well be me. It doesn’t make a recursive backend workflow the wrong way to go here, but it’s something you might want to keep in mind and keep an eye on.

Hope this helps.

Best…
Mike

Thanks alot @mikeloc . I really appreciate this. I will try it straight away.

1 Like

@thekeybeats2 I am building an Electronic Medical Record EHR. I have a type of thing called Requested Investigations. Now a doctor after seeing a patient is going to request some investigations. So as he select the investigations he wants from list of available investigations, that list is temporarily stored in a custom state List. Then, when he finishes, he clicks on submit and i want the custom state list to save to Requested Investigation thing as separate row entry Not as a list under one entry. Hope I am clear now

@mikeloc I tried what you suggested. It did work by creating the first item on the list several time. It didnt loop in to the second, third items… I realised that the expression count-first item >0 can’t hold because the first item is not a number. I still need some help please.

In the second action of the backend workflow, are you defining the list to send to the workflow as the custom state list:minus item custom state list's:first item? And the condition on that step should be something like custom state list:minus item custom state list:first item:count > 0. Can you share some screenshots of your setup?

I even tried to use the index of the items but i dont have access to the index of each item on the list

You shouldn’t need the count or index parameters. Try setting the Only when condition to exactly what you have as the RG Selected Investigation parameter, and then add the :count operator to the end of the expression.

I defined a parameter “count” to be the count of the RG selected investigations. So if the count minus the first item >0 it should reiterate. But the first item is not a number

That condition is not the same as the expression above it… try RG Selected Investigations:minus item RG Selected Investigations:first item:count > 0.

Its working now! in this RG Selected Investigations:minus item RG Selected Investigations:first item:count > 0, the :First item will not give me option for :count. It only bring out the fields in the data type Investigations
Thanks so much for the help. I really appreciate it. I have been on this for several weeks now.

1 Like

I was probably missing parentheses in my expression, but glad to hear it’s working now.

:+1: Thanks

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