Query Object Compatibility

Official Content
This documentation is valid for:

Changes in GeneXus 16

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.

Grammar changes

The grammar associated to the Query Object was updated and improved. The following sections detail the associated changes.

IN

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, ...)

By

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, ...)

changes to:

Average (att1) by att2, att3, ...

The same criteria is followed as for the for each clause.

DefinedBy

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, ...)

changes to:

Count (att1) defined by att2, att3, ...

WeightedBy

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)

changes to:

Average (att1) weighted by numericAtt2

Not

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]

changes to:

not att like "xxx"
not att in ("a", "b", "c")
not att in (1 to 10)

Is Null

Expressions with the IS NULL clause changes to use the IsNull() function:

att is null
att is not null

changes to

att.IsNull ()
not att.IsNull ()

Filters in aggregations

Filters within an aggregation function are removed; the expressions:

Sum (att1 where att2 = "xxx")
Sum (att1) where (> 1)

change to:

Sum (att1) where att2 = "xxx"
Sum (att1) where Sum (att1)> 1

New Constructions

The following new language constructions were added.

Enumerated Domain

Enumerated Domain values can be used in filters and also formula fields, example

# Formula
Att + Domain.Element1
# Filter
CustomerSex = Sex.Female

Boolean Expressions

The use of booleans is less verbose, you can directly reference a boolean attribute in a filter, insted of using

Att = true
Att = false

simply write:

Att
not Att

Conditional Expressions

Support for conditional expressions, such as

<expr1> if <cond1>; <expr2> if <cond2>; <expr3> otherwise

Nullvalue

Use of the Nullvalue() function in query elements and filters:

# Edition
Nullvalue(att)
# Filter
Att <> Nullvalue (Att)

Miscellaneous

  • 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 byweighted by).

Changes in GeneXus X

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:

Upgrading from GeneXus X Upgrade #3 to GeneXus X Upgrade #4

Filter Section Breaking Change

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.

Query Viewer Control

The Query Viewer control has been improved supporting Java and .Net environments.