Run workflows as a while or a for loop help

Hi,

Have the following issue.
I have an application where I want to create a batch, that consist of a user specified amount of labnumbers (each a individual thing) and reference a reseller on both the batch and the individual labnumbers.

1 batch consist of
x amount of labnumbers
each labnumber belongs to a reseller y and a distributor z
batch belongs to reseller y and distributor z

I have created a database for batches, labnumbers, and resellers
I can create each of these individually and link them up.

I have created a form that takes the user input amount of kits and searches up the reseller.

When the user has completed the form and pressed the button “create batch”, I want to make the workflow “create batch” run the workflow “create kit” X amounts of time.
1 bubble create batch form
Could find out how to do this so tried the following:

Create batch

Start the workflow create a batch, set what organisation the batch belongs to. Add the amount of labnumbers the user wants to the batch. Create a serialised number for the batch.

Then i triggerd the custom workflow create a labnumber 1 - not sure what workflow thing to put in though.

Then I search up the last batch, and decrease the labnumbers wanted by 1.

Then I check that the wanted lab number is more than 0, and only then run “create labnumber 2” which has the same process as “create labnumber 1”. If not ran it should exit the workflow, will redirect to a specific page (not setup yet).

This will not run. I get the following error: Sorry, we ran into a temporary bug and can’t complete your request. We’ll fix it as soon as we can; please try again in a bit!

I do not think it has anything to do with a temporary bug, but rather that I possibly have created a endless loop. I really hope there is something really obvious that I have missed or overlooked, and appreciate any help in solving this.

Any ideas?

Yeah, you can’t do what you are trying to do in the way that you are doing it.

In Bubble you really need to know your “list” in advance.

So in reality, how many “labnumbers” are there ? Is it one per reseller/distributor. Or is a number that is typed in ?

You can certainly do what you want, but not in the loop way.

Thanks NigelG

There are quite a lot of labnumbers.
The model is as follows:

Customer has: 1 x labnumber
Reseller has: 1 x batchnumer that includes x amounts of labnumbers. Most often a batch contains 10 labnumbers.

The actuall labnumbers are just last labnumber + 1. But the amount of labnumbers is a typed number.

Distributor needs to be linked to the batchnumber - and preferably to each of the labnumbers as well.

The lab numbers are created when a reseller or distributor orders new dna sampling kits - each kit needs a premade labnumber, or serial number if you wish. This labnumber is printed and added to the kit before reseller, distributor and customers receive the kit.

You can generate a loop for x using the Toolbox plugin.

Use the “List of Numbers” function.

Then you can Schedule an API on that list.

That will loop the workflow x time.

Have added and example to BoB.

https://buildingonbubble.com/block/create-x-things-1508306175092x250559076540612600

1 Like

@nigel is it possible to apply this method to an existing list in a RG and then update each existing thing in the repeating group with a corresponding number generated

Yes, if I understand the question correctly then we did something similar recently. Use the “List Of Numbers” and Item# on an RG.

2 Likes

Ahhh Bisto! Thanks @NigelG Nigel

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