|
|
|
|
|
- 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
Sort order of records found in a select query
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.
Adding a sort item into the current select query To add a sort item into the current select query: - Open the query description window: on the "Query" tab, in the "Edit" group, click "Description".
- In the middle section, select the desired item.
- 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: - Open the query description window: on the "Query" tab, in the "Edit" group, click "Description".
- In the middle section, select the desired item.
- Right-click to open the context menu of the item.
- 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: - Open the query description window: on the "Query" tab, in the "Edit" group, click "Description".
- In the middle section, select the desired item.
- Right-click to open the context menu of the item.
- 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: 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 Sort order](https://doc.windev.com/en-US/images/image.awp?langid=3&name=OrdreTri.gif&-1519979614) 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.
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.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|