For Each Text Part
This action splits a text at a specified delimiter pattern and loops through the part, assigning the next text part to a selected variable in each iteration.
Properties
The For Each Text Part step can be configured using the following properties:
- Input
-
The string to split can be specified in several ways using the Value Selector. If the contents of a tag should be split, you must first extract the tag text into a variable using the Extract step.
- Delimiter
-
Specify the delimiter at which to split the text.
See the example below where we split a text using "," as delimiter.
- Output
-
Specifies the variable in which the text part will be stored in each iteration.
- Skip Empty Output
-
If checked, the loop will skip iterations whose output would have been a text of length zero. For example if looping over the text "a,b,,c", the loop only contains three iterations (outputting "a", "b" and "c") if this property is checked. If the "Skip Empty Output" property is left unchecked, the loop contains four iterations (outputting "a", "b", "" and "c").
- Example
-
We have the following input text:
apple,pear,banana,grape,kiwi,pineapple
We want to iterate over the fruits and perform some action for each; for example store the name of the fruit in a database.
As delimiter, we specify: ,
and as output variable we select Fruit.name.
In the first iteration, the Fruit.name variable will contain the value apple, in the second iteration it will contain the value pear. The entire loop will contain six iterations and in the final iteration the Fruit.name variable will contain the value pineapple.