Returns the number of columns defined for an array.
Cols(&array())
Type returned:
Numeric constant, the same used to define the array.
Objects: Procedure, Transaction, Web Panel,
Panel, Data Provider
Generators: .NET, .NET Framework, Java, Apple, Android,
Angular
By using this function, the array's dimensions within the program source is avoided. Modifying the array's dimensions would only cause the corresponding modification throughout the model, but there would be no need to modify the program's source where the array is used.
The following example illustrates how to load a 2D-array whose elements are the sum of their bi-dimensional positions (row and column):
&I = 1
Do while &I <= rows(&m())
&J = 1
Do while &J <= Cols(&m())
&m(&I,&J) = &I + &J
&J += 1
EndDo
&I = &I + 1
EndDo
Rows Function