The array loop allows an array to be traversed in any direction using a set of parameters. It also allows any desired subsection of the array to be selected.
Parameter:
- Array name: The name of the array to be read from.
- Read mode: (optional) The type of traversal. The array can be read either row by row or column by column. Default: Row by row.
- Row sorting: (optional) Gibt an, ob die Zeilenindizes untereinander absteigend oder aufsteigend sortiert werden sollen. Standard: aufsteigend.
- Column sorting: (optional) Specifies whether the column indices should be sorted in descending or ascending order. Default: Ascending.
- From row: (optional) If specified, only values starting from the given row index are considered, including the specified index.
- To row: (optional) If specified, only values up to the given row index are considered, including the specified index.
- From column: (optional) Behaves the same as the “From row” parameter, but for column values.
- To column: (optional) Behaves the same as the “To row” parameter, but for column values.
- Variable for column index: (optional) The variable to which the value of the current column index is written.
- Variable for row index: (optional) The variable that holds the value of the current row index..
- Variable for value: (optional) This variable holds the value located at the current position being processed.
The array loop consists of three sections:
Group change start: If the read mode is “Row by row”, the following commands are executed at the beginning of each row, or technically speaking, whenever the row index changes.
If the read mode is “Column by column”, the commands are executed whenever the column index changes.
This section can be used, for example, to clear field contents.
Loop iteration: The following commands are executed for each populated cell. If a cell has not been set, it is ignored.
Group change: In “Row by row” read mode, the following commands are executed at the last cell of the row.
After all cells have been processed, this section can be used, for example, to process complete rows or columns.
The loop processes all existing records. This means that non-existing records are skipped.
In contrast to the “Read array value” command, which returns an empty string if a row-column combination does not exist, the loop will never process such a combination and therefore will not return anything for it.
Example:
Define array Addresses String, alphabetical sorting Number, numerical sorting
Set array value Addresses Name 1002 Bregenzer Festspiele
Set array value Addresses Country_ZIP_City 1002 AT-6900 Bregenz
Set array value Addresses Name 1001 VISION-FLOW Software GmbH
Set array value Addresses Street 1001 Riedgasse 11
Set array value Addresses Country_ZIP_City 1001 AT-6850 Dornbirn
Write file myAddressFile.csv
Array loop Addresses Row by row $ColumnName $AddressNumber $CellContent
Group change start
Set field temporarily $Name
Set field temporarily $Street
Set field temporarily $Country_ZIP_City
Loop iteration
Decision group
If $ColumnName = Name Name
If $ColumnName = Street Street
If $ColumnName = Country_ZIP_City Country_ZIP_City
If $ColumnName is alphanumeric general general
Branches
case Name
Set field temporarily $Name $CellContent
case Street
Set field temporarily $Street $CellContent
case Country_ZIP_City
Set field temporarily $Country_ZIP_City $CellContent
case general
Set field temporarily $FlexibleFieldName LOCAL: $ColumnName
Set field with variable field name $FlexibleFieldName $CellContent
otherwise
End decision group
Group change
Write data to file $AddressNumber ; $Name ; $Street ; $Country_ZIP_City
End array loop
End write file
The resulting file temp/myAddressFile.csv contains the following content:
1001;VISION-FLOW Software GmbH;Riedgasse 11;AT-6850 Dornbirn
1002;Bregenzer Festspiele;;AT-6900 Bregenz
