Array Operator ([ ])

On This Page

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.

Note
In the current release, the support for array attributes and the use of array operators and functions in expressions is restricted to the web APIs.

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 ctr is a numeric attribute with the value 2, references the fourth element (index 3) of the km array attribute.

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 or min 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 the arr 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 existing arr1 array attribute to an arr2 attribute.

See Also