Array Functions

On This Page
  • 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.

  • See also the array support of the max and min functions.



Returns the length of the provided array or array slice (ARRAY) — i.e., the number of elements in the array or slice. The parameter can be the name of an array attribute (ARRAY-ATTRIBUTE), or a slice of an array attribute that indicates the zero-based index range of the array elements to compare (ARRAY-ATTRIBUTE[istart..iend]).

For example, for a myArray array attribute with the values 7, 13, 5, and 1, "length(myArray)" returns 4 and "length(myArray[2..3])" returns 2.

length is supported in update expressions.


init_array(size, type)

Creates an array attribute and initializes all array elements to zero. The function receives the following parameters:


The size of the array — i.e., the number of elements in the array.

  • Type: Integer
  • Requirement: Required

The data type of the array elements.

  • Type: String
  • Requirement: Required
  • Valid Values:

    • 'int' — a 64-bit integer
    • 'double' — a 64-bit double

For example, an "arr = init_array(3, 'int')" update expression creates an arr array attribute that represents an integer array with three elements, all initialized to zero. You can also change the values of specific elements in the same expression — for example "arr=init_array(3, 'int'); arr[1]=1; arr[2]=arr[1]+1;" results in a new arr array attribute with three elements whose values are 0 (default), 1, and 2.

After creating an array attribute, you can use the array operator ([]) to reference array elements .

See Also