Order rule

Official Content
This documentation is valid for:

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

Although valid for a Web Panel without any grid, its usefulness, in this case, is unclear, since as only one database record is displayed, if well programmed, the developer should have uniquely identified it, so 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.

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

For Panels, since GeneXus X Evolution 3, the order rule only applies to the form (its fixed-part, not the grids), since form (fixed-part) determines its own base table, different than the grids. 

Syntax

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

Description

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 name must be written between brackets. You may include attributes with both ascending and descending orders.

Examples

1. The following transaction has been defined to store client information, where 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);

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 could be included:

Order((InvoiceDate), SupplierId);

Scope

Objects Web Panel object, Work Panel objectWork With for Smart Devices objectPanel object
Platforms Web, Win, Smart Devices
   

See also