Table of Contents

Search

  1. Preface
  2. Function reference
  3. Constants
  4. Operators
  5. Dates
  6. Functions
  7. System variables
  8. Datatype reference

Function Reference

Function Reference

Dot operator (Arrays of structs)

Dot operator (Arrays of structs)

Use a dot operator with an array of structs to access elements from each struct in the array.

Syntax

To access an element in an array of structs, use the following syntax:
array_of_structs.element
The following table describes the arguments in the syntax:
Argument
Description
array_of_structs
Array data type. Array of structs from which you want to access elements in each struct.
You can enter any valid transformation expression that evaluates to an array.
element
Name of the struct element that you want to access.

Return Value

Array that contains the specified element from each struct.
NULL in the following situations:
  • The element in the struct has a NULL value.
  • The struct is NULL.

Examples

You have the following array with three struct elements and each struct has three elements:
employee_info_array = [ derrick_struct{ name: 'Derrick' city: NULL state: 'NY' }, kevin_struct{ name: 'Kevin' city: 'Redwood City' state: 'CA' }, lauren_struct{ name: 'Lauren' city: 'Woodcliff Lake' state: NULL } ]
The following expressions use a dot operator to access the elements in each struct in the array:
Input Value
RETURN VALUE
employee_info_array.name
['Derrick','Kevin','Lauren']
employee_info_array.city
[NULL,'Redwood City','Woodcliff Lake']
employee_info_array.state
['NY','CA',NULL]

0 COMMENTS

We’d like to hear from you!