Rows function

Official Content
This documentation is valid for:

Obtains the return of the number of rows defined for an array.

Syntax

Rows(&array())

Type Returned:
Numeric
    Is a constant, the same used to define the array.

Scope

Objects: Procedure, Transaction, Web Panel, Panel, Data Provider
Generators: .NET.NET Framework, Java, Ruby (up to GeneXus X Evolution 3), RPG, Visual FoxPro (up to GeneXus X Evolution 3), Cobol, Apple, Android, Angular

Description

By using this function, referring 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.

Samples

The following example illustrates how to load a 2D-array whose elements will be the sum of their bidimensional positions (row and column). Notice the &m variable uses the Dimensions property to Matrix.

&I = 1
Do while &I <= Rows(&m())
    &J = 1
    Do while &J <= Cols(&m())
         &m(&I, &J) = &I + &J
         &J = &J + 1
    EndDo
    &I = &I + 1
EndDo

See Also

Cols function
Dimensions property