This section details changes made to the Query Object since GeneXus 16 Upgrade 11.
In case of using GeneXus 16 Upgrade 11 and Query Objects, it is mandatory to update GeneXus Server to the same upgrade; check the compatibility section for further detail.
The grammar associated to the Query Object was updated and improved. The following sections detail the associated changes.
The IN operator with straight brackets changes to curved brackets; it applies to a list of values with parentheses, for example the expression
att in [value1, value2, value3, ...]
changes automatically to:
att in (value1, value2, value3, ...)
The By (att1, att2, att3, ...) with parentheses clause is no longer mandatory; to add an attribute but before grouping by another one (for example, to calculate the monthly average of the invoices) use the By clause. The expression:
Average (att1) By (att2, att3, ...)
Average (att1) by att2, att3, ...
The same criteria is followed as for the for each clause.
The DefinedBy (att1, att2, att3, ...) with parentheses clause is no longer mandatory and is separated into 2 words. To change the base table (for example to count not all Customers but Customers with Invoices) use the defined by clause. The expression:
Count (att1) DefinedBy (att2, att3, ...)
Count (att1) defined by att2, att3, ...
The WeightedBy (att) with parentheses clause is no longer mandatory and separated into 2 words. To do a weighted average use the weighted by clause. The expression:
Average (att1) WeightedBy (numericAtt2)
Average (att1) weighted by numericAtt2
Expressions with the NOT clause (used in the middle of expressions) is moved to the beginning. These expressions:
att not like "xxx"
att not in ["a", "b", "c"]
att not in [1 to 10]
not att like "xxx"
not att in ("a", "b", "c")
not att in (1 to 10)
Expressions with the IS NULL clause changes to use the IsNull() function:
att is null
att is not null
not att.IsNull ()
Filters within an aggregation function are removed; the expressions:
Sum (att1 where att2 = "xxx")
Sum (att1) where (> 1)
Sum (att1) where att2 = "xxx"
Sum (att1) where Sum (att1)> 1
The following new language constructions were added.
Enumerated Domain values can be used in filters and also formula fields, example
Att + Domain.Element1
CustomerSex = Sex.Female
The use of booleans is less verbose, you can directly reference a boolean attribute in a filter, insted of using
Att = true
Att = false
Support for conditional expressions, such as
<expr1> if <cond1>; <expr2> if <cond2>; <expr3> otherwise
Use of the Nullvalue() function in query elements and filters:
Att <> Nullvalue (Att)
- Each expression is fully validated in edition time to prevent errors later on while generating the SQL statement.
- Better Undo support (query edition).
- Better intellisense support, suggestions for attributes, method names, parameter names, enumerations and other clauses applicable to aggregations (by, defined by, weighted by).
This section details changes made to the Query Object since GeneXus X.
When upgrading GeneXus X, if you are using queries check the following compatibility section:
Several changes have been done to the query filter section making the new specification (upgrade #4 or higher) incompatible with the old one (upgrade #3 or lower).
If you are using filters in your queries; you will need to delete all the filters section and add them again using the new specification.
The Query Viewer control has been improved supporting Java and .Net environments.