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

Struct with Array Elements

Struct with Array Elements

To access elements in an array that is within a struct, use a dot operator followed by a subscript operator. The dot operator first accesses the specified array element in a struct. Then, the subscript operator accesses elements in the array based on the index value.
For example, you have the following struct with the array elements
drinks, sandwiches,
and
salads
.
menu_struct{ drinks: ['milk','coffee','tea','chai'] sandwiches: ['ham','turkey',NULL] salads: ['caesar','cobb','greek','chipotle'] }
When you use the expression
menu_struct.drinks[0]
, the dot operator first accesses the array element
drinks
. Then, the subscript operator accesses the element at position 0 in the array
drinks: ['milk','coffee','tea','chai']
. The return value is
milk
.
The following expressions use a dot operator followed by a subscript operator to access elements from the arrays in the struct
menu_struct
:
Input Value
RETURN VALUE
menu_struct.drinks[1]
'coffee'
menu_struct.sandwiches[2]
NULL
menu_struct.salads[3]
'chipotle'
menu_struct.drinks[0,3]
['milk','coffee','tea']

0 COMMENTS

We’d like to hear from you!