It is one of the three main components of the Data Provider output-based declarative language.
It sorts a set of subordinate Elements or other 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.
<GroupName>
[<GroupProperties>]
[From <BaseTrn1>|<BaseTrn.Level1>,...,<BaseTrnN>|<BaseTrn.LevelN>]
[<Order1>,...,<OrderN>]
[unique <Att1>,...,<AttN>]...
[using <DataSelectorName>([<parm1>,...,<parmN>])]...
[<Input>]
[<Condition1>,...,<ConditionN>]
'{'
<variableStatement> | <elementStatement> | <subgroupElementInsertion> | <groupStatement>...
'}'
View Syntax conventions
Where:
GroupName
Name of the group in the output, i.e, name of an element of the output SDT o BC.
GroupProperties
Designed to have better control of the Output. It can take one of the following values: Default, NoOutput, OutputIfDetail, Paging, or One.
BaseTrn1|BaseTrn.Level1, ..., BaseTrnN|BaseTrn.LevelN
Is a Transaction or Transaction.Level name (or several separated by commas) to be used as the base table to be navigated. Read more in Base Transaction clause.
Order1,...,OrderN
Allows indicating the order in which the query will be returned. As the syntax indicates, you can write many conditional order clauses.
unique
Returns only those records where the set of values of the referred attributes is unique.
Att1,...,AttN
It is a list of attributes separated by a comma.
using
Allows ordering and filtering according to the criteria set out in the Data selector specified by its name DataSelectorName.
DataSelectorName
Is the name of the Data Selector object.
parm1, …, parmN
Are variables defined in the called object or attributes.
Input
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.
Condition1,...,ConditionN
Specifies any valid logical expression that conditions the data retrieval. It can be a compound condition, using 'and', 'or' and 'not' logical operators.
variableStatement
They are locally declared variables that can be used to do internal calculations.
elementStatement
An Element is an atomic value in the Data Provider Output which may also be of a SDT data type.
subgroupElementInsertion
It can be defined as follows: <SubGroupName>.Insert( [<parm1>, <parm2>, ...] ) .
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 Condition1,...,ConditionN in syntax), although allowed, becomes meaningless against the Base Transaction clause.
Consider the following Transaction object:
Customer
{
CustomerId
CustomerName
CustomerAddress
CustomerPhone
CustomerEmail
CustomerBalance
}
And the following Structured Data Type (SDT) object:
The following Data Provider navigates the Customer Base Table filtering those customers whose CustomerBalance > 1000. It loads and returns a collection of customers that fulfills the condition:
SDTCustomers From Customer
where CustomerBalance > 1000
{
SDTCustomersItem
{
Code = CustomerId
Name = CustomerName
}
}
Another sample code is:
SDTCustomers From Customer order CustomerName unique CustomerName
using DataSelector1()
{
SDTCustomersItem
{
Id = CustomerId
Name = CustomerName
}
}
Notes:
- Order and Where clauses apply to Input attributes, not to SDT Elements. For example: 'Order CustomerName' is valid but 'Order Name' is not. In fact, the order will cause 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).