Convert is of text to list of

Hohoho Everyone,

I’m once again stuck with a list of things. I can’t seem to find a good approach on the forum and am struggling to figure it out.

I have a backend API workflow where data from an API is received. This data contains an array:

"capcodes": [
    "002029568",
    "001520999",
    "001520032"
]

Bubble correctly recognizes this as a List. For each API request (webhook) that comes in, I create a new “Thing” and store this list in it as a List of Text.

However, these numbers correspond to a Thing in the “Capcodes” data group. So, in the “Thing” I create, I have also created a List of Capcodes. Now, I want to convert this List of Text into a List of Capcodes and add it to the created Thing.

I believe the solution might lie in using an API Workflow on a list (I get this working for the first item). But again, I’m not able to figure it out.

This is correct. May have something missing in your setup.

When you run your initial flow that retrieves the whole object (not just the capcodes) you’re going to create the parent object (meldingen) as you are.

Create a 2nd backend workflow that’s called “create-capcodes” it will contain 2 Params

Meldingen (type meldingen)
capcode (type text) (do not check list/array)

After the initial parent object (meldingen) is created then you’re going to have another action in the first main workflow that schedules an API workflow on a list. You should be able to select the capcode text list from the original API response and the “create-capcode” API workflow.

The “create-capcode” workflow will have 2 actions. Create a new capcode & make changes to a thing (meldingen parent object from param you passed). You’ll then update the capcode list there by doing “meldingen capcodes:plus item results from step 1” (creation of the capcode action)

Bare in mind, from your other post about conserving WU, this is not a WU friendly way of doing it at all but is the only way you will be able to store the capcodes as their own objects.

1 Like

Thanks Chris! Yeah I missed Type of things text, and always checking “List” so that things I fixed. I now got this.

Screenshot 2023-12-26 131540

I don’t need to creat a new capcode, these are allready existing. It is only working now with when there is 1 capcode in the list.

What did I missed?

You actually don’t need the capcode param (remove that). It’s being handled in the list of text you’re passing.

Honestly not too sure why the first one is only populating. Not enough info on your app. Maybe privacy rules hiding them?

1 Like

I’ve been experimenting a bit and succeeded. Of course, I need to include the specific text in the run to create a loop; otherwise, it only takes the first one. Thanks for your help, Chris, I eventually managed to do it! Thank you, and Merry Christmas!

Screenshot 2023-12-26 142204

1 Like

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