ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Query editor / Operations on queries
  • Overview
  • How to?
  • Adding a sort item into the current select query
  • Deleting a sort item from the current Select query
  • Modifying the sort order of an item in the current select query
  • Tip
  • Notes
  • Defining several sort items
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
To make the result of a query easier to read, the records can be sorted according to one or more items. Sorting the records means classifying them in an ascending order or in descending order.
For example, the customers can be sorted by name, from A to Z.
Remark: Only the items displayed in the query result can be sorted.
The sort order is defined when creating the query. However, you can:
  • add or delete a sort item.
  • modify the sort order performed on an item.
How to?

Adding a sort item into the current select query

To add a sort item into the current select query:
  1. Open the query description window: on the "Query" tab, in the "Edit" group, click "Description".
  2. In the middle section, select the desired item.
  3. Open the context menu of the item, then click "Sort item" and select the sort order.
Remarks:
  • To add a sort item, you also have the ability to click the "Sort" button found in the right section and to select "Sort by the selected item".
  • The query editor can also be used to perform a sort on a parameter. All you have to do is click the "Sort" button and to select "Sort by parameter". In this case, you must specify the name of the parameter that will be used for the sort as well as the default sort order. This sort order can be modified at runtime if the content of the parameter contains the sort order. For example: "Customer.CustomerName ASC". This parameter must be passed to the query when it is run. For more details, see Passing parameters to a query.

Deleting a sort item from the current Select query

To delete a sort item from the current select query:
  1. Open the query description window: on the "Query" tab, in the "Edit" group, click "Description".
  2. In the middle section, select the desired item.
  3. Right-click to open the context menu of the item.
  4. Select "Sort item .. Don't sort".

Modifying the sort order of an item in the current select query

To modify the sort order of an item in the current select query:
  1. Open the query description window: on the "Query" tab, in the "Edit" group, click "Description".
  2. In the middle section, select the desired item.
  3. Right-click to open the context menu of the item.
  4. Select "Sort item" and select the new sort direction of the item.

Tip

To add, modify or delete a sort, click the column used to sort the query items and select the operation to perform in the following menu:
Sort menu
Notes

Defining several sort items

When several sort items are defined, the sorts are nested. To find out the sequence of the different items, click Sort order found in the middle section. The sort starts from the first item found in the table of sorted items.
For example, in the window below, the query result is sorted:
  • on the total amount of orders first,
  • then on the country of customers,
  • then on the city of customers,
  • finally on the name of customers.
Sequence of sorts
The arrows found to the right of the window are used to modify the sequence of sort items.
Remark: The numbers found beside the arrows also allow you to find out the sequence of the different sort items.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help