Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

[ Image Removed |../../index.htm#lansa/jmp_sortoptions_dlg.htm]
You are here:

...

To make your query's results easier to read, you may wish to sort the data into a more useable sequence.
You can specify your sorting requirements either from the Query window, before the query is run, or from the Results window after the query has been run. There are advantages to sorting your data before you run the query. These are explained in 3.11 Performance Considerations.
To specify your sorting requirements, select the Sort Options command from the Options menu or select this icon from the toolbar.
When you select this command, the Sort Options dialog box appears.

 
The Sort Options dialog box contains:
Field
A list of the fields you can sort on. You can include more than one field in a sort.
Sort Type
The sort type indicates that you wish to select the corresponding field for sorting. Choose the sequence you want by clicking on the arrow to the right of this box and select either:

...

The result of your query may vary when the Maximum Record number is used to limit the number of records retrieved. To avoid any variations, you should define your query so that the sorting is always done at the host.
Top-10 Style Query
By using a combination of Sort options and Maximum records, you can create a Top-10 style query. You could use this style of query to obtain, for example, the ten salesmen with the highest sales or your 6 best-selling products. To do this, you need to ensure that the data is sorted in descending sequence on the IBM i. To ensure that the data is sorted on the host, either create a join query or use the Like operator with an All Values prompt, and use the Output Options command to set the Maximum records to 10, or the number you require.
[ Image Removed |../../index.htm#lansa/jmp_sortoptions_dlg.htm]