Table of Contents

Search

  1. Preface
  2. The Transformation Language
  3. Constants
  4. Operators
  5. Variables
  6. Dates
  7. Functions

Transformation Language Reference

Transformation Language Reference

Multidimensional Array

Multidimensional Array

A multidimensional array is an array of arrays, which can have up to five levels of nesting. You can use subscript operators to access arrays at any level or specific elements in an array at the innermost level.
You can use subscript operators to return the following values:
  • A specific element in an array at the innermost level.
  • One or more arrays at any level.
  • A subset of one or more arrays at any level.
To access a specific element in an array at the innermost level, you use more than one subscript operator. The number of dimensions in a multidimensional array determines the number of subscript operators to use. Each subscript operator must contain one index value. The data type of the return value is the same as the data type of the elements in the array.
For example, in a two-dimensional array, you use two subscript operators. The first subscript operator determines which one-dimensional array to access. The second subscript operator determines which element to access within the array.
The following two-dimensional array contains three arrays and each array contains elements of type string:
menu_array = [ ['milk','coffee','tea','chai'], ['ham','turkey',NULL], ['caesar','cobb','greek','chipotle'] ]
The following expressions use two subscript operators to access a specific element from each one-dimensional array within the
menu_array
:
Input Value
RETURN VALUE
menu_array[0][1]
'coffee'
menu_array[2][3]
'chipotle'
menu_array[1][2]
NULL
The following expressions use a single subscript operator to return one-dimensional arrays in the
menu_array
:
Input Value
RETURN VALUE
menu_array[0]
['milk','coffee','tea','chai']
menu_array[0,2]
[ ['milk','coffee','tea','chai'], ['ham','turkey',NULL] ]
menu_array[1,0]
[ ]
menu_array[NULL,2]
NULL
The following expressions use two subscript operators to return a subset of arrays within the
menu_array
:
Input Value
RETURN VALUE
menu_array[0][0,2]
['milk','coffee']
menu_array[2][0,3]
['caesar','cobb','greek']
menu_array[0,2][0,3]
[ ['milk','coffee','tea'], ['ham','turkey',NULL] ]

0 COMMENTS

We’d like to hear from you!