The Split Loop

The Split loop is used to split a text value and store each part separately as rows in a list in the database. This method can be used to separate a row of a CSV document, break-up date values and split other character separated texts.

To achieve this a custom loop needs to be created with the split function at its core:

Data model:

  • Create a transient numeric field called Index to keep track of the current item.

  • Create a numeric ItemCount field to count the number of items resulting from the split.

  • [Input.Text] field, which provides the text value that needs to be divided into rows.

Flowchart:

  • Set Index to 1 to reset the current split part to the first item.

  • Set ItemCount to the number of items resulting from the split function: count(split([Input.Text], ';')).

  • Check if ItemCount is more than zero; this is important to avoid an endless loop when Index and ItemCount never meet.

  • Add or go to the row where current value needs to be saved.

  • Assign the current value to the correct field with the following function: count(split([Input.Text], ';'))(Misc.Index) The (Misc.Index) chooses the split part that needs to be assigned.

  • Add 1 to the Index to process the next item;

  • Check if the Index is less than or equal to the ItemCount: [Misc.Index] <= [Misc.ItemCount]

  • When ItemCount is less then the index the decision node results in true and goes back to the add or go to row node to repeat the loop.

  • When Index is greater than ItemCount, all split items are added, and you can leave the loop to save your changes and exit the flow.

Example:

Last updated