Add Grid From Transaction action

Objective

Adding grids to a web panel generated using K2BWebPanelDesigner involves many steps, as the developer must select the grid's columns, its filters, and its orders. To simplify this process, K2BWebPanelDesigner includes the "Add grid from transaction" action. Using this action, a grid is added to the web panel using a pattern-like inference, which determines which columns, filters, and orders should be included in the grid based on the selected transaction's structure.

The inferred grid may not suit all needs, but is a very good starting point that the developer can customize later to suit its particular requirements.

How it works

Adding a grid from a transaction involves four steps:

  1. Choose the node under which the grid should be created. The developer may choose nodes from any type, as long as they support having grids as child nodes.
  2. Select the "Add Grid From Transaction" action in the Actions menu inside the contextual menu belonging to the node chosen in the previous step.
    AddGridFromTransactionMenu
    Contextual menu

  3. Choose the transaction the grid should be based on.
    AddGridFromTransctionChooseTransaction
    Transaction selection

  4. Choose the layout that should be used when generating the grid. In this point you can choose a dynamic layout, a standard grid, or a free style grid.
    AddGridFromTransctionChooseLayout
    Layout selection

  5. Choose if the grid should be created using attributes or variables. See differences between these options below.

After following these steps, the result will be similar to the one shown below.

AddGridFromTransactionGeneratedGrid
Generated grid

Differences between adding attributes or variables

Using this action, the developer can choose to include variables or attributes inside the grid definition. In the first case, a grid with an inferred for each will be created. On the other hand, if attributes are added a grid with a base table will be created.

Adding a grid with variables, adds the possibility of filtering the rows to display using complex conditions (which can't be included inside a GeneXus grid condition property), and the possibility to add logic inside a user subroutine that may, among other things, prevent a specific row from being added.

Grids with a base table should be used when the navigation that should be used is easy to specify by explicitly naming the attributes.

Grid inference

Columns

All transaction's attributes are included as columns in the inferred grid. Attributes that are part of a foreign key referring to a transaction whose description attribute is also included are included, but are not visible by default.

Filters

The transaction's attributes that will be included as filters in the grid are:

  • The Description Attribute for the transaction
  • The Description Attributes for all transactions referenced in this transaction.
  • Attributes with type "Date" (if the property "Generate Date Filters" in K2BWebPanelDesigner settings is set to true)
  • Attributes with type "DateTime" (if the property "Generate Date Time Filters" in K2BWebPanelDesigner settings is set to true)

Orders

Orders will be generated for:

  • Attributes present in the primary key with a type different from Blob or LongVarChar.
  • The description attribute (if its type is different from Blob or LongVarChar).