Inputs in Grids within Grids

From GXtest Wiki
Revision as of 19:41, 15 August 2013 by Ftoledo (Talk | contribs)

Jump to: navigation, search
Spanish.gif
English.gif
link= {{{3}}}

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

Imagine that you have a page which lists in a grid all the invoices and there you list every item of the invoice. In that example, suppose the grid that the invoice lists is called GridInvoices, and this grid that has the lines of each bill is called GridInvoiceLine. Then suppose you need to do two checks with the command VerifyControlTextTable on InvoiceLineAmount and InvoiceLineNumber fields.

To perform these validations you should use the following commands:

  • SetGridContext (context ContextGridInvoice allows you to execute commands on the first row of the grid of invoices)
    • OutputGrid = ContextGridInvoice
    • InputGrid = (empty)
    • Grid = GridInvoice
    • SelectionRule = ByRow (1)
  • SetGridContext (context ContextGridInvoiceLines allows you to execute commands on the first line of the first invoice)
    • OutputGrid = ContextGridInvoiceLines
    • InputGrid = ContextGridInvoice
    • Grid = GridInvoiceLines
    • SelectionRule = ByRow (1)
  • VerifyControlTextTable (now the command tells you to use the appropriate context)
    • Grid = GridInvoiceLines
    • Control = InvoiceLineAmount
    • SelectionRule = ByContext (& ContextGridInvoiceLines)
  • VerifyControlTextTable (now the command tells you to use the appropriate context)
    • Grid = GridInvoiceLines
    • Control = InvoiceLineNumber
    • SelectionRule = ByContext (& ContextGridInvoiceLines)

Once the context was built, the same can be used for all commands you want.