Data provider Group statement

Official Content
This documentation is valid for:

Previous version

It is one of the three main components of the Data Provider output-based declarative language.

It sorts a set of subordinate Elements or another Groups. It may or may not be a collection. GeneXus is intelligent enough to figure out when the Group is a repetitive one and when it is not. With repetitive groups, a group is like a for each, with many of its clauses being valid.

Syntax

<groupStatement> ::=

<GroupName>

[<GroupProperties>]         

[From <BaseTrnList>]

[<OrderList>]

[<UsingDataSelector>]

[<UniqueAttributeList>]

[<Input>]

[<ConditionList>]

'{'

{<variableStatement> | <elementStatement> | <subgroupElementInsertion><groupStatement>}...

'}'

where:

<GroupName>::=

[@] <Name>

name of the group in the output, i.e, name of an element of the output SDT o BC

<GroupProperties>::= <Default> | <NoOutput> | <OutputIfDetail> | <Paging> | <One>
 

Designed to have better control of the Output. They are:

<Default> when a group does not matches the conditions and programmer needs to output something instead of the group, anyway.

<NoOutput when programmer needs the group itself is not present, only its subordinate elements.

<OutputIfDetail> when is needed a group with a group inside (a child) only be in the output if there are elements in the group inside (in the child).

<Paging> in order to control how many records will go to the Output.

<One> allows returns only the first record from a navigation of many.

<BaseTrnList>::= Same as Base Transaction clause in For Each command 
<OrderList>::= Same as Order clause in For Each command
<UsingDataSelector>::= Same as Using DataSelector clause in For Each command
<UniqueAttributeList>::= Same as Unique Clause in For Each command
<Input>::=

Input {<ForIter>|<ForIn>}

When a scan through a collection/array/matrix variable is needed, in order to do something with each item values (from a source other than database) inside the group body. See Input clause for <ForIter> and <ForIn> syntax, and further information.

<ConditionList>::= Same as Where clause in For Each command
   
<variableStatement>::= <variableName> '=' <Formula>
<elementStatement>::= <elementName> ['=' <Formula>] [<elementProperties>
 

   where:

<Formula>::= <horizontalConditionalFormula> | <aggregateConditionalFormula> | <compoundConditionalFormula>

It is a conditional formula (horizontal as well as aggregate or compound). That is, it could be several conditional expressions.

Note it could be a Data Provider or Procedure call, that returns a structured output whose data type must match the <variableName>/<elementName> data type.

<elementProperties>::= '['<Default>']' '['<XmlInfo>']'

<XmlInfo>::= '[' XmlType = { attribute | cdata | element | value } ']'

See Data provider Element statement for more info.

<subgroupElementInsertion>::=  <SubGroupName>.Insert( [<ParameterList>]
 

where <SubGroupName> should be declared as a subgroup, by means of a Data Provider Subgroup statement.

   

Note

The Defined By Clause from previous versions of GeneXus (located after <ConditionList> in syntax), although allowed, becomes meaningless against the Base Transaction clause.

Example

Customers
{
   Customer
      Order CustomerName
      where CustomerBalance > 1000
   {
         Code = CustomerId
         Name = CustomerName
   }
}

Notes:

  • Order and Where clauses apply to Input attributes, not to Elements. For example: 'Order CustomerName' is valid but 'Order Name' is not. In fact, the order will cause an access to the Database.
  • The behavior is the same as in a For Each command. This includes the way to determine the base table, and the fact that conditional order clauses as well as conditional where clauses are valid. The same happens with the 'USING' Data Selector clause and the 'IN' operator used in a where clause (that is, Data Selectors can also be used in a Data Provider group, in the same way, same syntax, as in a For each. See some Data Selectors in Data Providers examples).



Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.