Array.GetLength

Top  Previous  Next

Returns the length of an existing array.

 

Syntax

function Array.GetLength(AArray: array): integer

 

Alternative Names

Array.Length

 

Description

GetLength returns the length of the given array.

 

AArray holds a previously created array of any length.

 

The Return Value is the current length of the array.

 

Example

execute UDSBlock returns (length_value integer, single_array_value varchar(100))

as

begin
  /* create an array with 3 elements */

  array_value = Array.Create('zero', 'one', 'two');

  single_array_value = array_value[0];

  length_value = Array.Length(array_value);

  suspend; /* returns 3 and 'zero' */

  

  /* extends array with another 2 items */

  Array.SetLength(array_value, 5);

  single_array_value = array_value[3];

  length_value = Array.Length(array_value);

  suspend; /* returns 5 and NULL */

end