Modifier

Partager via


OrderBy Property

Version: Available or changed with runtime version 3.0.

Sorts table fields in the page view in ascending or descending order.

Applies to

  • Page View
  • Query

Property Value

Column=Ascending|Descending

  • Column is the name of the query column as specified by its Name Property.

  • Ascending sorts the column from lowest value to the highest value (A to Z, 0 to 9).

  • Descending sorts the column from highest value to the lowest value (Z to A, 9 to 0).

Note

Separate multiple columns with a comma.

Remarks

In the OrderBy property, you add a column by name and set its direction to ascending or descending:

view(MyFirstView)
{
    Caption = 'This is my first view!';
    OrderBy = Ascending (Address);
}

To sort on multiple columns, separate each column with a comma, like OrderBy = ascending (Name), descending (Quantity).

Note

You cannot sort on the same column more than once.

Note

For views you can only use one direction; either Ascending or Descending.

The OrderBy property corresponds to the Order By clause in SQL select statements.

Example

This following table shows the results of a query that retrieves the quantity of items in every open sales order for each customer.

Customer Quantity
The Cannon Group 50
New Concepts 15
New Concepts 30
Selangerian Ltd. 20
Selangerian Ltd. 60

To sort the Customer column in ascending order and the Quantity column to descending order, you set the OrderBy property to Name=Ascending,Quantity=Descending. The following table shows the results of the query after sorting.

Customer Quantity
New Concepts 30
New Concepts 15
Selangerian Ltd. 60
Selangerian Ltd. 20
The Cannon Group 50

The following is the Order By clause in SQL that corresponds to the OrderBy property in this example.

OrderBy = ascending (Name,Quantity);  

Query Properties
View Properties