ForEach
Description (v1.2.3)
This action iterates over a list of values ([ValueListVariable]) separated by a [Separator].
The [InstanceVariable] is set with the current value (first position equals 0)
Release notes
Version 1.2.3 - Early deployment
- Improvement: Added ampersand separator (M0)
- Dependency:
- Redirect Action version 1.6.0 or higher (must be used in the whole callflow to go through the action ForEach multiple times)
Version 1.2.2 - Early deployment
- Bugfix: Support predefined separator (M13679)
- Dependency:
- Redirect Action version 1.6.0 or higher (must be used in the whole callflow to go through the action ForEach multiple times)
Version 1.2.1 - Deprecated
- Improvement: Added the possibility to use dash as separator (M11074)
- Deprecated: Doesn't support predefined separator (M13679)
- Dependency:
- Redirect Action version 1.6.0 or higher (must be used in the whole callflow to go through the action ForEach multiple times)
Version 1.2.0 - General deployment
- Feature: It is now possible to go through the same ForEach multiple times (see dependencies) (M7540)
- Bugfix: Use a namespaced variable 'comma' in order to not overload the global parameter COMMA (M7982)
- Dependency:
- Redirect Action version 1.6.0 or higher (must be used in the whole callflow to go through the action ForEach multiple times)
Version 1.1.3 - Deprecated
- Bugfix: Use a namespaced variable 'comma' in order to not overload the global parameter COMMA (M7982)
- Deprecated: Bugfix did not cover all use cases
Version 1.1.2 - General deployment
- Improvement: renamed 'parameter 2' to 'List Variable'
Version 1.1.1 - General deployment
- Bugfix: In some cases foreach was never executed on Asterisk-1.2x (M6585)
- Bugfix: Comma separated input list was not working on communication server 2
Version 1.1 - General deployment
- Bugfix: The semicolon separator was unusable
Version 1.0 - General deployment
- Improvement: Compatibility with the Communication Server module
Version 0.1 - General deployment
- Value list variable can be an existing variable or configured in the text box
Version 0.0 - General deployment
Action parameters
This action iterates over a list of values separated by a given separator.
The action will exit to a 'do' output if the last position in the list is not reached.
The action will exit to a 'end' output if the last position in the list is reached.
In order to loop in the Foreach, a Redirect action must be used.
Starting at version 1.2.0, it is possible to enter the same
ForEach action multiple times.
The new implementation implies the following facts:
- A Redirect action version 1.6.0 or higher must be targeted directly on the ForEach action for the iteration to continue.
- That Redirect action must be a child of the ForEach action.
This corresponds to the intuition that "The loop continues while a child Redirect node returns to it".
Otherwise,
ForEach restarts at the beginning of the list.
Parameters:
- List Variable: Variable which contains the list of 'Separator'-separated values to iterate over.
- Instance Variable: Variable which will contain the current list value in the 'do' branch.
- Separator: List Separator
When using a semicolon separator, make sure that you properly escape the ";" characters in the global parameter editor. e.g. "1\;2\;3". Otherwise the communication server will discard any characters after and including the first semicolon.
Example of use
This action can for example call sequentially a list of numbers separated by a semicolon: