Array Operator ([ ])
Overview
The platform enables you to define array attributes — blob attributes that represent numeric arrays of 64-bit integer or double values.
See Array-Attribute Expression Variables.
You can use one of the following syntax variations of the array operator ([]
) to reference specific elements of an array attribute in expressions.
In all variations, an element's index number can also be provided as an expression that evaluates to an integer.
Single Array Element
ATTRIBUTE[i]
This syntax references an element at the specified zero-based index (i
) of an array attribute (ATTRIBUTE
).
For example, "km[ctr+1]"
, where
Array Slice
ATTRIBUTE[istart..iend]
This syntax references an array slice — a range of elements between the specified zero-based start (istart) and end (iend) indexes of an array attribute (ATTRIBUTE
).
Note that the range includes the end index.
In v3.6.1, the following uses of array slices in expressions are supported:
- As a parameter of the
max ormin function — to retrieve the highest or lowest value from among the elements in the specified array slice. For example,"max(arr[2..10])"
returns the highest value from among the values of thearr array attribute's elements at indexes 2 to 10. - As an operand of the array operator (
[]
) in a SET update expression — to assign a slice of an existing array attribute to another array attribute. For example,"SET arr2 = arr1[0..4]"
assigns the values of the first five elements of an existingarr1 array attribute to anarr2 attribute.