Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Script

The following script extracts a set of values from a list of positive numbers, to create a sublist.

do(
  $list = $args[1],
  $firstInteger = $args[2],
  $secondInteger = $args[3],
  $subList = [],

  forEach($i,$firstInteger..$secondInteger,
    $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.

Set Minimum Parameters and Maximum Parameters to 3.

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

subList([value1, value2, value3,...], <startPosition>, <endPosition>)


ArgumentType
valuenA value of any type
startPositionInteger representing where to start extracting values.
endPositionInteger representing where to stop extracting values. 

Example

subList([1,2,3,4,5,6,7,8,9,10],6,9) 

returns the portion of the supplied List between element positions 6 and 9: [6,7,8,9]




  • No labels