Skip to content

ForEach

Miriam McMahon edited this page Apr 27, 2023 · 5 revisions

Description

Executes a block of commands on each element in a collection of items

Parameters

Parameter Name Description Type Resolved Type Required
CollectionName The name of the variable that contains the collection to iterate through String String Yes
ElementName The name of a variable that will be set to an item of the collection each time through the loop String String Yes
Body The commands to be executed in the loop Do Block n/a Yes
MaxIterations Limit the maximum number of iterations for the loop. Added in v7.2 Value Integer No

Examples

{
  "SetItem": {
    "Name": "rhymeString",
    "Value": [ "Mary", "had", 37, "little", "lambs" ]
  }
},
{
  "ForEach": {
    "CollectionName": "rhymeString",
    "ElementName": "word",
    "Body": {
      "Do": [
        {
          "Log": {
            "Text": "The word is: %word%"
          }
        }
      ]
    }
  }
}