How do I loop through an Array in Bridge?

Options
jessmm
jessmm ✭✭
edited 06/07/24 in API & Developers

Hello!

I have been trying to loop through an Array in Bridge, and can't seem to figure it out. From what I can find online, I need to use a child workflow and send the Array there while also setting the child workflow's "number of runs" equal to the length of the Array.

This is partially working. The Array is being sent over to the child workflow, and on every run it is sent with an index value as well. (see below)

From here, the only issue I'm running into is how to use the index value I'm being given to access the data in the Array.

Each object in my Array contains a sheetId, a rowId, and a columnId. So, on each run of the child workflow I need to be able to access those values using the index provided.

I have tried a few variations including: {{runtime.entities.data.{{runtime.index}}.columnId}} , {{runtime.entities.data.runtime.index.columnId}}, and {{runtime.entities.data.index.columnId}}, etc.

Nothing that I have tried so far seems to be working. I have a coding background and am used to being able to loop through Arrays quite easily. Is there some other way I should be going about this that I'm missing? If anyone has an idea, please let me know.

Thank you in advanced for any help!

Answers

  • Kelly Moore
    Kelly Moore ✭✭✭✭✭✭
    Options

    Hey @jessmm

    Based on your screenshot, I'm a bit confused with your scenario. I am unsure if you have one array and you're not quite sure what to do with the output, or, if you have multiple arrays that you must tease apart. I'm assuming the first. If it's the latter, let me know and I have an example of that.

    This example workflow is triggered off a change in value to a multi-select dropdown. I needed each individual multi-select value inserted on a new row in a different sheet. The multi-select values are the array that is split by the Split Text action. Note the Split Text output becomes the Number of Runs for the Child workflow. All of the data I want carried to the Child flow must be listed out as a Child Entity value.

    The array data is passed through the runtime.data

    Does this example answer your question? If not, ask me for specific details.

    Kelly