You are here: Using BML > Functions & Scripts > 1-D Arrays

1-D Arrays

OVERVIEW

The following functions initialize arrays without specifying the size. At a later time, when the values are assigned in different array indexes, the system expands the array into the appropriate size automatically.

Specifying a negative number (including NaN, which is equal to -999999) for the array size throws a runtime exception. For example, arr = float[-9]; throws a RuntimeException.

When you specify the array size equal to jNaN, then an array of size 0 is initialized.

Contact admin for size limits.

ADMINISTRATION

ClosedBoolean()

Initializes a Boolean array with the specified size.

For a Boolean array, the value in each field of the array after the array declaration (for example, arr = boolean[10];) is equal to false if the array fields are not initialized.

Boolean arrays are dynamic in nature and the length can be increased.

Syntax: Boolean[] boolean[Integer n]

Parameters:

# Parameter Data Type Description
1 boolean Boolean Array Used to declare a boolean array.
2 [n] Integer Optional: Use number "n" to declare an array of a specific size.

Return Type: Boolean Array

Example of boolean():


ClosedDate()

Initializes a Date array with the specified size.

For a Date array, the value in each field of the array after array declaration (for example, arr = date[10];) is equal to null if the array fields are not initialized.

Date Arrays are dynamic in nature and the length can be increased.

Syntax: Date[] date[Integer n]

Parameters:

# Parameter Data Type Description
1 date[] Date Array Used to declare a datearray.
2 [n] Integer Optional: Use number "n" to declare an array of a specific size.

Return Type: Date Array

Example of date():


ClosedFloat()

Initializes a Float array with the specified size.

For a float array, the value in each field of the array after array declaration (for example, arr = float[10];) is equal to 0.0, if the array fields are not initialized.

These arrays are dynamic in nature and the length can be increased.

For example:

Syntax: Float[] float[Integer n]

Parameters:

Return Type: Float Array

Example of float():


ClosedInteger()

Just as you do for string arrays, in order to initialize an array of a particular size, use the function integer[n]. This function initializes an Integer array with the specified size.

For an Integer array, the value in each field of the array after array declaration (for example, arr = integer[10];) is equal to 0 if the array fields are not initialized.

These arrays are dynamic in nature and the length can be increased.

For example:

Syntax: Integer[] integer[Integer n]

Parameters:

Return Type: Integer Array

Example of integer():

In contrast to string[], if you define an array size without initializing array fields, you will see a 0 instead of null.


ClosedString()

Initializes a String array with the specified size.

For a String array, the value in each field of the array after array declaration (for example, arr = string[10];) is equal to null if the array fields are not initialized.

These arrays are dynamic in nature and the length can be increased.

For example:

Syntax: String[] string[Integer n]

Parameters:

Return Type: String Array

Example of string():


ClosedUninitialized Arrays

In order to show you the different ways to declare arrays, we will display two separate arrays below. myArray will show you what to expect if you define an array size without initializing array fields. yourArray will show you what is returned when you define the size of an array as well as initialize the fields.


ClosedExample of Uninitialized Arrays

As you can see, myArray returned a string with four null values because array fields were not initialized after the array was declared.


NOTES

    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.

    The maximum number of columns allowed in a 1-D array is 1000.
    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

Related Topics Link IconSee Also