You are here: Using BML > Functions & Scripts > Array Functions

Array functions


An array is an ordered collection of values references by a single variable name. You could think of an array as a table, with values in rows and columns. Another way to think of arrays is in relation to an x-y axis. If you recall, data sets are formatted as (x, y). Data in arrays is similar:

(row, column)

(x, y)

("color", "shape")



Syntax: append(arrayID, newArrayElem)

The function append() will attach a new element to the end of an array and can be used with initialized and uninitialized arrays. Append works with 1-D arrays ONLY.


Return Type: Integer (denotes the new size of the array)

Example of append():


Syntax: findinarray(arrayID, element)

This function is used to check whether a certain element exists in an array. If it does, the index is returned, otherwise a -1 is returned. Findinarray() can only be used with 1-D arrays.


Return Type: Integer (denotes the index of the element in the array)

Example of findinarray():


Syntax: isempty(arrayIdentifier)

This function determines if the array is empty. Isempty() can only be used with 1-D arrays.


Return Type: Boolean (True if array is empty and False if it is not)

Example of isempty():

The string array above is empty, therefore TRUE is returned.


Syntax: max(arrayIdentifier)

Returns the largest element of an integer or float array. This function can only be used with 1-D arrays.


Return Type: Returns an Integer or Float, depending on the type of array.

Example of max():


Syntax: min(arrayIdentifier)

Returns the smallest element of an integer or float array. Min() can only be used with a 1-D array.


Return Type: Returns and Integer or Float depending on the type of array.

Example of min():


Syntax: range(x)

Declares an integer array with a specified size and initializes it to its index value.


Return Type: Integer[]

Example of range():

We will populate a 1-D array below. Since range declare an array of indexes, we can loop through the variable that range is equal to in order to populate a new array. Using range allows you to loop through the index values and use those to pull information out of the old arrays and input those values into the new array.


Syntax: remove(arrayIdentifier, removePos)

The function removes an element from an existing array based on a given index.


Return Type: Integer (denotes the size of the new array)

Example of remove():

You can see the new array that is being returned once the element at index[2] is removed.


Syntax: reverse(arrayIdentifier)

This function is used to reverse all elements in the array. Reverse() can only be used with 1-D arrays.


Return Type: Returns the array with all of the elements in reverse order.

Example of reverse():


Syntax: sizeofarray(arrayIdentifier)

This function returns the length of the array for a 1-D array and the number of rows for a 2-D array.


Return Type: Integer

Example of sizeofarray():

Closed1-D Array: sizeofarray(arrayIdentifier)

Closed2-D Array: sizeofarray(arrayIdentifier)


Syntax: sort(arrayID, [sortOrder], [sortType])

This function sorts array elements based on defined sort method. You can sort in ascending or descending order.

Sort() can only be used with 1-D arrays.


Return Type: String Array, in the specified sort order

Example of sort():


    BML size limits have default settings. The default row size is 5000. The default column size is 50.

    To increase the default row and column size, open a ticket on My Oracle Support.
    NULL and blank Integer values are treated as separate values.

    - NULL= 0
    - Blank = ""

    If you use logic that tests for NULL values in rule conditions or BML, this logic should be updated.

    Using "null" as an attribute value is strongly discouraged.


Related Topics Link IconSee Also