For each index
Overview
The for each index deluge task iterates through the index of all elements present in a list .
Syntax
for each index <loop_variable> in <list_variable>;
Parameter | Description |
---|---|
<loop_variable> | Variable to hold an individual element index for each iteration. You can specify any variable name here, without having to declare it initially. After the iteration, this variable will hold the index of the last element in the list. |
<list_variable> | The list variable containing the elements which need to be iterated. Data type is List. |
This task can be used in the following events
When a record is Created | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Created or Edited | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Edited | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Deleted | ||
On Validate | Yes | |
On Success | Yes | |
Other workflow events | ||
On a scheduled date | Yes | |
During approval process | Yes | |
During payment process | Yes | |
In a Custom Function | Yes | |
In an Action item in report | Yes |
Example
The following code snippet displays the index number of each element along with the element name:
colorList = {"red", "green", "blue"};
for each index colorIndex in colorList
{
info "("+colorIndex+")"+colorList.get(colorIndex);
}
for each index colorIndex in colorList
{
info "("+colorIndex+")"+colorList.get(colorIndex);
}
The output will be the following:
(0)red
(1)green
(2)blue