Inputs in Grids within Grids

From GXtest Wiki
Revision as of 18:25, 10 March 2010 by Ftoledo (Talk | contribs)

Jump to: navigation, search


There are applications with grids within grids. This is allowed with GeneXus through FreeStyleGrid. For these situations GXtest don't record the actions of those fields within the grid included in the parent grid, so it is necessary to add the commands manually.

For this there is SetGridContext command. It allows creating a grid context which provides a selection criteria for a grid. This command can be used consecutively and concatenated to have various levels of inclusion.

SetGridContext Command

SetGridContext command has the following parameters:

  • OutputContext (type variable): This variable will return the context of the grid. This context is built from the other parameters. Then this variable is a context which will be used in the commands that perform actions that are in control grids within grids.
  • InputContext (Variable type is optional): This input is a context that can be used to mount the new context. When an action needs to be done in several nested grids you need to use this field.
  • Grid (type Control): grid on which it will set the context.
  • SelectionRule: selection criteria for the grid Grid.

Example

Say you have a page which lists in a grid all the invoices and each invoice within its lines are listed. In that example, suppose the grid that lists the bills and called GridFactuas that has the lines of each bill is called GridFacturasLineas. Then suppose you need to do two checks with the command VerifyControlTextTable on FacturaLineaMonto and FacturaLineaCantidad fields.

To perform these validations should use the following commands:

  • SetGridContext (context ContextoGrillaFacturas allows me to execute commands on the first row of the grid of invoices)
    • OutputGrid = ContextoGrillaFacturas
    • InputGrid = (empty)
    • Grid = GridFactuas
    • SelectionRule = ByRow (1)
  • SetGridContext (context ContextoGrillaFacturasLineas allows me to execute commands on the first line of the first bill)
    • OutputGrid = ContextoGrillaFacturasLineas
    • InputGrid = ContextoGrillaFacturas
    • Grid = GridFactuasLineas
    • SelectionRule = ByRow (1)
  • VerifyControlTextTable (now the command tells you to use the appropriate context)

Grid = GridFactuasLineas Control = FacturaLineaMonto SelectionRule = ByContext (& ContextoGrillaFacturasLineas) VerifyControlTextTable (now the command tells you to use the appropriate context) Grid = GridFactuasLineas Control = FacturaLineaCantidad SelectionRule = ByContext (& ContextoGrillaFacturasLineas) Once the framework was built, the same can be used for all commands you want.