Declaring an Array Variable

The following data types are available for an array:

  • Numbers

  • Strings

  • Variants

  • Records

You cannot write code that uses the Declare Variable statement to declare an array of arrays or an array of objects.

You include a subscript list as part of the variableName argument to declare an array variable. You can use one of the following formats:

Dim variable([[startSubcript To] endSubscript, ...]) As typeName
Dim variable_with_suffix([[startSubcript To] endSubscript, ... ])

The following table describes the startSubscript and endSubscript arguments.

Argument Description

startSubscript

The index number of the first array element, followed by the following keyword:

To

endSubscript

The index number of the last element of the array.

Specifying Arguments When Declaring an Array

The startSubscript argument is optional. If you do not specify it, then Siebel VB uses zero as the default value. For example, the following statement creates an array named counter that includes elements 0 through 25, for a total of 26 elements. You can use the Set Array Lower Boundary statement to modify the default value:

Dim counter (25) as Integer

The values in the startSubscript argument and the end Subscript argument are valid subscripts for the array.

Size Limits of an Array

You can specify no more than 60 arrays in a parent array. The maximum total number of elements cannot exceed 65,536. For example, the following code is valid because 60 multiplied by 1092 is 65,520, which is less than 65,536:

Dim count(1 To 60, 1 To 1092)

The following code is not valid because 60 multiplied by 1093 is 65,580, which is more than 65,536:

Dim count(1 To 60, 1 To 1093) 

Each subscript declares one array that resides in the parent array. If you do not specify the subscriptRange argument, then Siebel VB declares the array as a dynamic array. In this situation, you must use the Declare Array method to specify the dimensions of the array before your code can use it.