Hitachi

JP1 Version 11 JP1/Script Description and Reference (For Windows Systems)


8.2.8 GetArrayCount (count the elements in an array variable)

Purpose

Counts the elements in an array variable (or the number of rows or columns in a two-dimensional array).

Syntax
GetArrayCount (ArrayName)
Argument
ArrayName

Specify the array variable as a variable name.

Description

The GetArrayCount command gets the number of elements in a specified array variable (or the number of rows or columns in a two-dimensional array). On successful completion, the command returns the number of elements, or the number of rows or columns for a two-dimensional array. If an error occurs, the command returns a zero-length string ("").

If you specify a dynamic array variable, the GetArrayCount command returns the number of elements (or rows or columns) already set.

Examples
' A is a fixed one-dimensional array variable. This code
' stores the number of elements (10) in variable result1.
Dim A(10)
result1 = GetArrayCount (A)
 
' B is a fixed two-dimensional array variable. This code
' stores the number of columns (10) in variables result2
' and result3, and the number of rows (5) in variable
' result4.
Dim B(5, 10)
result2 = GetArrayCount (B(1))
result3 = GetArrayCount (B(5))
result4 = GetArrayCount (B)
 
' C is a dynamic two-dimensional array variable. This code
' stores the number of columns (1 and 7) in variables
' result5 and result6, and the number of rows (2) in
' variable result7.
Dim C(,)
C(2,1) = "SUN"
C(2,2) = "MON"
C(2,3) = "TUE"
C(2,4) = "WED"
C(2,5) = "THU"
C(2,6) = "FRI"
C(2,7) = "SAT"
result5 = GetArrayCount (C(1))
result6 = GetArrayCount (C(2))
result7 = GetArrayCount (C)
JP1/Script version

Supported from JP1/Script 06-00.