| | Description
This page explains the general aspects of grids with an inferred for each. These nodes are a particular case of Grid node and Grid (SD) nodes, so bear in mind that this page contains information only about things specific to this type of grid. If you can't find information about a certain feature that may be a general grid functionality, see the Grid node or Grid (SD) page.
A grid is defined to be "with an inferred for each" when it doesn't contain attributes and has at least one variable with the property "LoadFromAttribute" set to true. As the name suggests, when using these grids a For Each command is generated in the Load event for the grid.
To simplify the process of creating grids with an inferred for each, the "Add Grid From Transaction" quick action was created. To obtain a grid of this type, the developer must answer "Yes" when asked "Do you want to add attributes as variables?".
This type of grid must be used when the navigation implied is easy to specify, but one of the following statements is true:
- The developer wants to specify conditions that can't be placed in grid conditions (when the grid has a base table).
- The developer wants to filter which rows should be loaded using a (custom) complex logic.
- The developer wants to place specific code when there are no records available to load.
- The developer wants to use the "distinct" clause.
- The attributes that should be loaded do not define the base table correctly, so the developer must use the "defined by" clause.
The runtime appearance of a grid with base table is equal to the appearance of a generic Grid node or Grid (SD).
Note: In this section only specific grid properties are shown. General properties for grids can be found on the generic grid documentation.
Category |
Name |
Value |
General |
Conditions |
Indicates conditions to load grid. Grid conditions are placed inside foreach where clause. Must be separeted by ; |
AdvancedConditions |
Conditions that can be placed inside a "foreach where" but not inside "grid conditions" must be placed here. Must be separeted by ; Examples of this type of conditions are the in operator (in DataSelector) or agregate conditions Ex: Get all Invoices that have &ProductId in one of it´s lines. count(InvoiceProductQuantity, ProductId = &ProductId)) >=1 when not &ProducdtId.IsEmpty() |
DefinedBy |
Allows to place a defined by in generated for each. Use this property when variables with load from attribute in true doen´t determine base table. Click here to see GeneXus documentation of DefinedBy Clause. |
Distinct |
Set to true it generates a distinct clause in generated foreach. Click here to see GeneXus documentation of distinct clasue. |
Base Trn |
Determines if a base transaction should be specified when generating the grid. Only available when the grid was created via the "Add Grid From Transaction" Action. |
Unique |
Used to define the unique clause in the generated for each. This can be used to avoid repeated elements in the grid. |
The main event associated to this node is Grid.Load event.
|
Infered For Each Load Code |
Load code for grids of this type is generated using a For Each command. Filter conditions are placed inside where clause. Variables with load from attributes set to true are loaded automatically from its corresponding attributes. Other variables must be loaded inside the "U_LoadRowVars" user subroutine.
Inside this subroutine, the developer can choose whether the current row should be loaded or not by setting the value of the "&LoadRow_{InternalName}" to true or false respectively.
The developer can also determine if the grid should be reloaded or not after executing an action, by setting the value of the variable "&Reload_{InternalName}".
In the following table, {InternalName} should be replaced with the value of the property "Name (Id)" of the grid. Only subroutines specific to this type of grid are shown. To see generic grid subroutines, check the Grid node page.
Name |
Description |
'I_LoadCount_{InternalName}' |
Number of records loaded. Cannot be changed by the developer. |
'HasNextPage_{InternalName}' |
Set to true means that grid has a next page, false if it's the last page. Cannot be changed by the developer. |
'LoadRow_{InternalName}' |
This variable determines if the current row should be loaded. Can be changed by the developer inside U_LoadRowsVar{InternalName} event. |
'Reload_{InternalName}' |
Reload the grid or keep last load. Can be changed by user inside actions user code.
Note: Only available when the web panel is not generated with Smooth User Experience
|
In the following table, {InternalName} should be replaced with the value of the property "Name (Id)" of the grid. Only subroutines specific to this type of grid are shown. To see generic grid subroutines, check the Grid node page.
Name |
Moment of execution |
Detailed description and possible uses |
'U_LoadRowVars({InternalName})' |
This subroutine is invoked inside load event. |
The prupose of this subroutine is to load grid variables or actions. Also it can be used to determine whether to load a record or not. For this prupose a global variable named &LoadRow_Grid{InternalName} can be set to false ir order to not load that record.
|
'U_WhenNone({InternalName})' |
This subroutine is invoked inside load event when there are no records to load. |
The prupose of this subroutine is to take an action when there are no records on the grid. Ex:Tell de user that there are no records that match the conditions.
|
|