For Each Line Command

Official Content
This documentation is valid for:
Forces the processing of every line (loaded) or selected in a grid.

Syntax

For each line [ in <GridName> ]
       code
Endfor

Where:

code
Sequence of valid language commands.

Description

Allows you to process all lines or selected lines in the grid. It can be used, for example, to mark all the lines that fulfill a specific condition.

For Each Line has the following properties and restrictions:

  • It only processes the records loaded from the grid.
  • It processes all lines whether they have been modified or not.
  • The lines are processed in the same order as they were selected.

Notes:

  • In the Enter event, if the For each line command is used, each line is processed. However, it is the programmer's responsibility to update the grid values.
  • In non-visual generators, you can only select the line on which the cursor is (simple selection) positioned. In Visual FoxPro it is not possible to select many lines from a grid (it's a Visual FoxPro restriction and not of the generator).
  • For Each Line command is supported in nested Grid (since X Evolution 3 Upgrade 7). The external Grid must be a Free Style, and the parent row must be instanciated. That means, the button that trigger the event must be inside the parent's grid or the event must be programed in this way:
For Each Line in ExternalGrid
   For Each Line in InternalGrid
   ...
   Endfor
Endfor

Examples

Event Enter // We want to put an * to all processed lines
    For each line
        If &Op = '*' // If it already has an * we put '\'
           &Op = '\' 
        Endif
        If &Op = '/' // The line is processed
            Call ...
            &Op = '*'
        Endif
    Endfor
EndEvent

Scope

Objects: Web Panels
Languages: .NET, Ruby (up to GeneXus X Evolution 3), Java, RPG, Visual FoxPro (up to GeneXus X Evolution 3), Cobol

See Also

For Each command



Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.