The sysLib.size() system function returns the number of rows in the specified data table or the number of elements in the specified array. The array can be a structure-field array or a dynamic array of variables or records.
If the array name (arrayName) is in a substructured element of another array, the returned value is the number of elements in the structure field itself, not the total number of occurrences in the containing structure (see the "Examples" section later in this topic).
sysLib.size(arrayName ANY in) returns (result INT)
// Calculate the sum of an array of numbers sum = 0; i = 1; myArraySize = sysLib.size(myArray); while (i <= myArraySize) sum = myArray[i] + sum; i = i + 1; end
Record ExampleRecord 10 siTop CHAR(40)[3]; 20 siNext CHAR(20)[2]; end
Given that you create a record variable based on ExampleRecord, you can use sysLib.size(siNext) to determine the number of elements for the subordinate array:
// Sets count to 2 count = sysLib.size(myRecord.siTop.siNext);
myArray INT[]; size(myArray);
A validation error occurs if you reference a variable that is not an array or a data table.
Platform | Issue |
---|---|
JavaScript generation | The function sysLib.size() is not supported. |