Forum Academy Marketplace Showcase Pricing Features

[SOLVED] - How to create multiple things at once (either with a button press or when a recurring element loads ...)

Hi,

I have two table: Product_List (a list of products) and PH_Level (which records intermittent PH value of the product).

I want to record PH_Levels in a new entry each time a user submits them (so that I can eventually graph a trend line).

I also want my users to be able to submit PH levels of multiple products (filtered by custom fields). I have managed to do so using a temporary variable and save button that “makes changes” to a list of PH_level rows (that were filtered into a repeating group).

However, I now need a way to create a list of PH_Level rows to replace the ones that were just used to record the PH levels.

Here is the public app where I have been trying to accomplish it:
https://forum-feedback.bubbleapps.io/version-test?debug_mode=true

See workflows here: https://forum-feedback.bubbleapps.io/version-test?debug_mode=true

Could you please suggest a way to create workflows for a button that allows me to create multiple new things (while picking up its details from a a list filtered into a recurring group) .

Thanks in advance for your help,
PK

As far as I know, the only way to create multiple records, is to Schedule an API Workflow on a list. So your API Workflow (paid feature) will create one record, taking in some parameters and your page workflow will call it, passing it the parameters it needs.

1 Like

thanks for the quick reply. Hoping to achieve this without a API :slight_smile:

@louisadekoya I am actually struggling with with the API too. How do I pass the input field from the repeating group to the API workflow?

To work on a repeating group , you need to do “schedule API on a list” … With you list being your repeating group.

Pass through the items on your list to the API as parameters.

1 Like

Thanks @NigelG. Will update you on the progress.

What should the scheduled date/time be - current date/time + 1 second?

And the interval - 0.1secs? What’s recommended?

hi @NigelG - got the API to create new element working. However, can not figure out how to pass an input box (placed inside the repeating group to collect PH_Level) to the API as a parameter.

Could you may be add this functionality to your demo on saving repeating groups?

Thanks a tonne!

Not quite sure what you want to achieve ?

I have a repeating group of Table Product_List. In that repeating group - I have added an input box to collect PH Levels. When I press submit, I want to create new entries in Table PH_Levels (Product_List, PH_Level, Date).

I can not find a way to directly pass this input box as a parameter when defining the endpoint workflow.

My solution currently involves a temporary field in Table Product_List called Temp_PH_Level - which is auto-binding to the input field. When I press submit, I pass the value stored in this field to Table PH_Level. And whenever the page loads I reset the value of Temp_PH_Level to null.

I was hoping if there was a way to do it without involving a temporary field.

Thanks,
Pranjal

This is surprisingly tricky to do, for a number of frustrating Bubble reasons that I won’t get into. That being said, the following seems to work, sort of, but I would be interested to see if anyone has a better approach.

The idea I had was to have a custom_state on the repeating group that is a list. I called it product_entries. Now every time a user enters a value in a cell, the product’s unique id and the value entered are added as a concatenated text (with a comma in between) to the product_entries custom state of the repeating group. So you end up with a list of all the values entered along with their corresponding product codes.

I then pass this list to an API Workflow (‘get_list_from_page’), which in turn runs another API Workflow (‘add_ph_entry’) on the list, adding each entry from the list to the ph_list table. The last bit requires some regex to extract the entered value from the text.

Some known issues with this are, a) if the user enters a value and then changes it, both values would be added I believe; b) the entered PH values are added as text rather than numbers; c) my regex is not great so there are trailing commas.

All of these are probably fixable with some more effort, but hopefully this gives you a starting point or some other ideas. Here is my editor to see what I did: https://bubble.io/page?type=page&name=productph&id=louisforum&tab=tabs-1

2 Likes

Thanks @louisadekoya.

1 Like

That is very clever :slight_smile: but rather complicated.

An easier way to handle these situations is to create the things on entry, with a status of “draft” (or something like that) then autobind the inputs. All that “Save” does is change the status to “Live”.

That then removes the complexity on the page, but now you just need some garbage collection at some point if you want to remove the “Draft” entries.

But you could always incorporate that into your app, so next time your user goes back in they have the option to pick up where they left off, or start again.

4 Likes

Hi @Nigel… so I followed these steps but for some reason I get the below error in red. Not sure what I’m doing wrong. Basically I want to save a list of questions from a repeating group of type “screening Questions” to type “Screening Questions Responses”. Could you assist?

My endpoint is:

So I figured it out and for a repeating group list of 4, it iterates 4 times. I can’t seem to get it to save the next record. If I do not use :first item it saves all 4 list items as one single record. If I use :first item, it repeats the first item on the list.

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