Description
UBound returns a Number containing the
largest available subscript for the given array.
Arguments
array is an array value, expression or
variable.
Action
UBound returns a Number containing the
largest available subscript for the given array.
Typical use
Commonly used to obtain the size of an
array before using a looping control mechanism to systematically manipulate
elements of the array.
Examples
Local NumberVar Array simpleArray;
Redim simpleArray[10];
UBound(simpleArray)
Returns 10.
Local DateVar Array dateArray;
dateArray := [CDate(#12/25/1998#), CDate(#12/24/1999#)];
UBound (dateArray)
Returns 2.
Comments
UBound returns 1 for an uninitialized
array variable, however, it causes an error to subscript an uninitialized array
variable. The reason for this behavior is that at present
Crystal Reports does not support arrays with zero elements.
To work around this problem, always initialize your array variables. For
example, initialize Global array variables in a formula located in the report
header and local array variables within the formula itself.