Order rule

Official Content
This documentation is valid for:

Establishes the order of a Web Panel's base table, when there is at least one grid.

Syntax

Order(<Att1>,<Att2>,....<Attn>);

Scope

Objects: Web Panel, Work PanelWork With for Smart DevicesPanel
Generators: .NET.NET FrameworkJavaAppleAndroidAngular

Description

This rule controls the order of the Panel's base table. If this rule is omitted and there is no order set at Order property grid level, the same standard used in Procedures is assumed: the primary key of the base table will be used.

To specify that a descending order is desired on any attribute from the list of attributes, the attribute's name must be written between brackets. Attributes with both, ascending and descending orders,.

Although this rule is valid for a Web Panel without any grid, its usefulness in this case, is unclear. As only one database record is displayed, the order does not seem to make much sense. It can be useful when it is required to keep the first or last record of a set ordered by some criteria, though.

On the other hand, when the Web Panel has one grid, this rule makes perfect sense because many records will be returned by the database query. Note, however, that the Order property of the grid could have been used instead.

Since GeneXus X Evolution 3, this rule only applies to the Panel's form (its fixed-part, not the grids), as the form (the fixed-part) determines its own base table, different than the grids'. 

Samples

Example 1 

The following transaction has been defined to store clients' information, where the clients are identified by a number (ClientId):

Client
{
    ClientId*
    ClientName
    ClientAddress
    ClientPhone
}

A Web Panel with a grid showing the client's information ordered by name could have the following rule:

Order(ClientName);

Example 2 

Given the following Invoice Transaction:

Transaction Invoice:

Invoice
{
    InvoiceId*
    InvoiceDate
    SupplierId
    SupplierName
    ...
}

For designing a Web Panel showing the invoices ordered by date (descending order) and supplier id (ascending order), the following rule needs to be included:

Order((InvoiceDate), SupplierId);

See Also

Order clause

Order property