How to loop through list without backend workflow

User would enter data like below in multiline input in my screen:
David, Blane,, 13788859500|4478392230
Robert, Mullo, , 3477772234|5378882203|3677772939
Silvia, Lester,, 8883448829
As you see in above, I have 3 records with individual fields like first name, last name, email and list of phone nos.
How do I split each record and each field and add them in my type contact (firstName, lastName, email, phones)

Please note that I am on free plan so cannot use backend workflows. Is there any other way to achieve this?

I have a solution, but without using recurssive workflows, it’s quite manual and tedious. I’ll add the steps below:

  1. Add a repeating group on your page. Set the type of content for this repeating group to be ‘text’.

For the datasource, reference the multiline input, but also add the ‘split by’ expression after this.

Inside the ‘split by’ field, hit enter and add a new line.

This means that it will split all of your entries by each line of your multiline input.

Inside the repeating group, you’ll also need to add a text element that displays the ‘current cell’s text’. I’ve also added a button that will trigger a workflow when clicked.

  1. Within the workflow, use the ‘sign a user up’ action. This is where things will get tedious.

What we need to do is create a way to extract each piece of data from the lines of text.

To do this, you can reference the ‘current cells text’ and then split each piece of text by the commas that separate them.

The only other thing we need to factor in, is that when each item is split by a comma, there’s a space before the actual text. So we need to remove this space.

To do this, attach the ‘find and replace’ expression to the existing string. In the field to define which text we want to find, just add a space. Then, for the field we want to replace it with, leave it blank. This just means it will find a space, then remove it.

Then after all of that, the last thing you need to do is determine which piece of data out of the entire line of text you want to save. In this case, the email address for the user is 3rd in your list, so you’ll need to reference item #3.

You can then just copy and paste this expression into any other relevant fields, then simply just replace the item number.

Now obviously, you’ll have to manually trigger this workflow for each use case. Without using recursive workflows, you won’t be able to automate the entire process on a list.

In my opinion, just spend the $29 and get access to backend/recursive workflows :sweat_smile:

Hope this helps point you in the right direction.

Unfortunately that buy workflow decision is not in my control. Anyway, I tried your solution but I doubt that can give complete automation by looping through all contacts. Is there any free plugin which can help to do this?

I think your question is more related to the looping part than how to split the fields so I will answer just to that.

I have not tried it myself but maybe you could set up 1 custom state “counter” and 2 different custom events “add to contact 1” and “add to contact 2”.
The first time you trigger “add to contact 1” and at the end, you increment the counter by 1 and at the end if “counter < number of contacts”, it triggers “add to contact 2”, which itself will do the same things but trigger back to “add to contact 1”

If you try it, please let me know if it worked :slight_smile:

Bubble really tries its hardest to make client-side looping impossible (or at least very difficult and slow), despite it being such a fundamental part of any programming or web development.

That said, there are a few ways you can achieve client side looping, such as looping 2 custom events (or event just one) using ‘Schedule’ custom event, or using a JavaScript to Bubble element to recursively trigger itself… ect.

But there is some hard speed limit imposed by Bubble for all of these things, so don’t expect it to be quick (compared to JavaScript)… and if you’re writing to the database as part of the loop function (which you are) it will be even slower (and will probably eventually time out)…

But in your case, as it’s only a small number of things you’re looping over, it will probably work just fine.

Thanks. As of now, I have shared this issue with looper plugin which is a free plugin