I really would like to solve this in Bubble and not externally but I keep bumping into issues here and hoping someone can help.
I’m sourcing data from an external open API and storing that response as a thing in “Data Type A”. The entirety of the response is stored in a comma delimited array as a single record. I need to be able to parse/break this array and create them as individual things in “Data Type B”.
I originally had hope for the “split by” function however that didn’t produce the results I wanted and appears to be useful more as a front end solution. Basically I need a way to iterate through the entire array but I am coming up short. I’ve captured the steps in my solution below along with a flowchart and would love to hear if you’ve come up with a solution to this.
- External API call
- Create a thing in Data Type A
- Parse newly created array from the record in Data Type A and create many things in Data Type B
- Delete thing from Data Type A
So i the response is a single string that contains comma separated values?
There’s no reason that :split by wouldn’t work for that on the backend - I store a lot of lists as single strings and use it like this all the time.
What’s the problem you’re having?
Yes. How in the world do you get it from that single string into separate records then?
Here is what my data looks like right now.
@exception-rambler - When I use split by I simply get a duplicated record. I’m hoping it’s something simple that I am missing. This is my workflow right now.
What’s the result that you’re looking for?
Is it a separate database Thing for every destination within the string-array that you receive from Theme Parks Wiki? Or are you trying to store a list of destinations inside a single database Thing?
Great question and I’m sorry if that wasn’t clear. Yes, a separate Thing for each destination as shown below.
Ok - there’s several ways you can do this.
The simplest is to create a 2nd endpoint -
create_destination or similar that you’ll use to process every individual item on the list.
Set it up something like this:
The new Workflow
The original workflow
Then call this endpoint for every item on the list by adding this in the original workflow:
Whilst this is the easiest, it’s not necessarily the most performant - you need to space out your calls that endpoint to avoid jamming it, 5 seconds is good practice. If you need to go fast then you can look at recursive workflows, or use the dedicated Bulk endpoint.
This is great @edwardbutcher! I’m one step closer. THANK YOU. Now…how would I handle multiple elements across the record? For instance the new records should have both a Name and Source ID. I truly appreciate your help and feel like as soon as I solve these things then many doors will open for me to complete this and other projects. [now I just jinxed myself]