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 Struct Elements

Struct with Struct Elements

A struct that contains one or more levels of structs is a nested struct. You can use dot operators to access structs at any level or specific elements in a struct at the innermost level.
You can use dot operators to return the following values:
  • A specified element in a struct at the innermost level.
  • One or more structs at any level.
To access a specific element in a struct at the innermost level, you use more than one dot operator. The number of levels in a nested struct determines the number of dot operators to use. The data type of the return value is the same as the data type of the element in the struct. For example, in a nested struct of two levels, you use two dot operators. The first dot operator accesses the specified child struct element in a parent struct. Then, the second dot operator accesses elements in the child struct.
The following example uses a struct
employee_info_struct
that contains two child structs
home_address_info
and
department_info
:
employee_info_struct{ emp_name: 'Derrick' home_address_info{ city: 'New York' state: NULL department_info{ NULL } }
The following expressions use dot operators to access elements from the struct
employee_info_struct
:
Input Value
RETURN VALUE
employee_info_struct.emp_name
'Derrick'
employee_info_struct.home_address_info
{ city: 'New York' state: NULL }
employee_info_struct.department_info
NULL
employee_info_struct.home_address_info.city
'New York'
employee_info_struct.home_address_info.state
NULL

0 COMMENTS

We’d like to hear from you!