For Each Line Command

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


For each line [ in <GridName> ]


The sequence of valid language commands.


It 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 that have been loaded and are visible in the Grid (If the Grid has Paging, it will only process the current active page rows)
  • It processes all lines whether they have been modified or not.
  • The lines are processed in the same order as they were selected.


  • 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, the command is supported in nested Grid (since X Evolution 3 Upgrade 7). The external Grid must be a FreeStyle, and the parent row must be instantiated. That means, the button that triggers the event must be inside the parent's grid or the event must be programmed in this way:
For Each Line in ExternalGrid
   For Each Line in InternalGrid


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


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

                    Smart Devices (Android, iOS) up to GeneXus X Evolution 2. 


See Also

For Each command