Hello Bubblers!
I’m working on a backend workflow in Bubble and I’m facing a challenge I hope you someone help me with.
I have a JSON response (array). The structure of the JSON is as follows:
[
{
"unique": "2688\t200\tOnbekend",
"amount": 2,
"unit_id": 0,
"unit_txt": "vel",
"code": "07-0000-0335",
"description": "MC glanzend 320 x 460 mm 150 g/m²",
"supplier": "I",
"source": "Onbekend",
"ordered": false,
"reference": "D5307114\t",
"usedby": "D",
"claim": "FSC Mix Credit"
},
{
"unique": "2606\t200\tOnbekend",
"amount": 57,
"unit_id": 0,
"unit_txt": "vel",
"code": "07-0000-0157",
"description": "MC glanzend 320 x 460 mm 300 g/m²",
"supplier": "I",
"source": "Onbekend",
"ordered": false,
"reference": "D5307115\t",
"usedby": "D",
"claim": "FSC Mix Credit"
}
]
In this JSON, I want to use the “unique” and “amount” in the next action. The action is again a API call for line 1 of the array, and line 2 of the array.
However, the number of line items can vary from 1 to 6 or more.
My current approach involves creating multiple actions with a control check like “IF count is 2, then execute index 2”. However, I’m seeking a more elegant and efficient solution.
What would be the best practice in this scenario to dynamically adjust the number of actions based on the JSON array? Any tips or examples of similar workflows would be greatly appreciated!
Thank you in advance for your insights!
Martijn