Script
The following script extracts a set of values from a list or array of positive numbersvalues, to create a sublist.
Code Block |
---|
do( $list = $args[1], $firstInteger$startPosition = $args[2], $secondInteger$endPosition = $args[3], $subList = [], forEach($i,$firstInteger$startPosition..$secondInteger$endPosition, $subList = addElement($subList, getElement($list,$i)), _NULL ), $subList ) |
The script does not handle zeros or negative numbers.
Using the Script as a Macro
Save this script into a macro named subList
.
...
In an expression, use the following syntax to run the subList macro in order to return a sub-list extracted from the supplied list.
Syntax
Code Block |
---|
subList([value1, value2, value3,...], <startPosition>, <endPosition>) |
Argument | Type | |
---|---|---|
valuen | A value of any type | |
startPosition | Integer representing where to start extracting values. | Cannot be zero or a negative number. |
endPosition | Integer representing where to stop extracting values. |
Example
Code Block |
---|
subList([1,2,3,4,5,6,7,8,9,10],6,9) |
...