ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Report editor / Operations in the editor
  • Overview
  • The different sort criteria
  • Adding a sort criterion
  • How to?
  • Modifying a sort criterion
  • Modifying a sort criterion in a report based on a data file or on a memory area
  • Modifying the sort direction of a criterion found in a report based on a query
  • Deleting a sort criterion
  • Deleting a sort criterion
  • Sort procedure
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
Sorts in a report
Overview
The sort is used to organize the information displayed in the report. Several sorts can be performed simultaneously: these sorts will be performed according to the display order of the sort criteria.
In the following example, in the wizard for report creation, the sort mode is defined: the data selected in the "Customer" file will be sorted according to the name of the country, then for each region, according to the name of the customer.
Wizard: sort definition
The sort criteria can be defined for a report based:
  • on a data file.
  • on a query.
  • on a memory zone.
The different sort criteria
A sort criterion can correspond to:
  • an item. The sort will be performed on this item.
  • a procedure name of the project (for example: "MyProc( )"). This procedure must return the value on which the sort will be performed. The procedure can accept parameters. This procedure can be global to the project or local to the report.
    For more details, see Sort procedure.
  • an expression based on a WLanguage function (for example: "Left(Customer.ZipCode,2)"). This function must return the value on which the sort will be performed.
  • a combination of the previous criteria.
Remark: The sorts will be performed according to the display order in the table that lists the sort criteria.
Adding a sort criterion
Adding a sort criterion to a report can be done:
  • in the wizard for report creation.
  • in the description of an existing report.
Remark: If the report is based on a query, a sort criterion can also be added from the query editor. For more details, see Sorting the query records.

How to?

  1. To add a sort criterion:
    • in a report being created, go to the step of the wizard relative to sort criteria.
    • in an existing report, on the "Modification" tab, in the "Report" group, click "Edit sorting". The list of sort criteria is displayed.
  2. Click the "New sort criterion" button (New sort criterion).
  3. To add:
    • a sort item: Select "Sort on an item" and select the sort item.
      The "<Multi-file>" option and the "Other" button are used to select an item via one or two cascading joins.
    • a sort procedure: select "Sort on WLanguage code" and enter the name of the sort procedure (for example: "MyProc( )").
      For more details, see Sort procedure.
    • a WLanguage function: select "Sort on WLanguage code" and enter the name of the WLanguage function that returns the value on which the sort must be performed.
      By default, the report editor proposes several WLanguage functions. To use one of these functions:
      - click the "Function" button,
      - select the requested function,
      - validate,
      - replace the parameters by the requested values.
  4. Validate the addition of the new sort criterion.
  5. Modify (if necessary) the sort direction of the criterion by clicking the "Sort direction" button or by clicking the arrow found in the table. If a break is defined on this sort criterion, the break will also be modified.
  6. Modify (if necessary) the order in which the sorts are performed via the arrow keys found on the right of the table. The sorts will be performed according to the display order of the sort criteria.
Modifying a sort criterion
Modifying the sort in a report can be done:
  • in the wizard for report creation.
  • in the description of an existing report.
Remarks:
  • A sort criterion can be modified from the editor for the reports based on a data file or on a memory zone.
  • You also have the ability to modify the sort direction of a criterion found in a report based on a query.

Modifying a sort criterion in a report based on a data file or on a memory area

To modify a sort criterion in a report based on a data file or on a memory area:
  1. To modify a sort criterion:
    • in a report being created, go to the step relative to sort criteria.
    • in an existing report, on the "Modification" tab, in the "Report" group, click "Edit sorting". The list of sort criteria is displayed.
  2. Select the sort criterion to modify.
  3. To modify the selected sort criterion by adding:
    • a sort item: click the "Item" button and select the item on which the sort will be performed.
      To select an item linked to the base file of the report via one or two cascading joins, select "Multi File".
    • a sort procedure:
      - click the sort criterion. The sort criterion automatically switches to edit.
      - enter the name of the sort procedure (for example: "MyProc( )").
      For more details, see Sort procedure.
    • a WLanguage function:
      • click the sort criterion. The sort criterion automatically switches to edit.
      • enter the WLanguage function that returns the value on which the sort will be performed.
        The report editors proposes several WLanguage functions used to perform sorts in the reports. To use one of the available functions:
        • click the "Function" button,
        • select the requested function,
        • validate,
        • replace the parameters by the requested values.
  4. Modify (if necessary) the sort direction of the criterion by clicking the "Sort direction" button or by clicking the arrow found in the table. If a break is defined on this sort criterion, the break will also be modified.
  5. Modify (if necessary) the order in which the sorts are performed via the arrow keys found on the right of the table. The sorts will be performed according to the display order in the table that lists the sort criteria.

Modifying the sort direction of a criterion found in a report based on a query

To modify the sort direction of a criterion found in a report based on a query:
  1. On the "Modification" tab, in the "Report" group, click "Edit sorting". The list of sort criteria is displayed.
  2. Select the sort criterion to modify.
  3. Modify the sort direction of the criterion by clicking the "Sort direction" button or by clicking the arrow found in the table. If a break is defined on this sort criterion, the break will also be modified.
  4. Modify (if necessary) the order in which the sorts are performed via the arrow keys found on the right of the table. The sorts will be performed according to the display order in the table that lists the sort criteria.
Remark: The sort direction of a criterion can also be modified from the query editor. For more details, see Sorting the query records.
Deleting a sort criterion
Deleting a sort criterion from a report can be done:
  • in the wizard for report creation.
  • in the description of an existing report.
Remark: If a break is defined for this sort criterion, the break will also be deleted.

Deleting a sort criterion

To delete a sort criterion:
  1. To delete a sort criterion:
    • in a report being created, go to the step relative to sort criteria.
    • in an existing report, on the "Modification" tab, in the "Report" group, click "Edit sorting". The list of sort criteria is displayed.
  2. Select the sort criterion to delete.
  3. Click Sort deletion.
Sort procedure
A sort procedure can be implemented in a report based on a data file or in a report based on a memory area. This procedure can be used to modify the sort criteria dynamically.
To implement a sort procedure:
  1. On the "Modification" tab, in the "Report" group, click "Edit sorting". The list of sort criteria is displayed.
  2. Click the "New sort criterion" button (New sort).
  3. Check "Sort on WLanguage code".
  4. Enter the name and value of the sort procedure parameters (for example: "SortVal("City")").
  5. Validate the addition of the new sort criterion.
  6. Create the sort procedure. This procedure must return the sort argument. For example:
    PROCEDURE SortVal(Criterion)
    // Sort by NAME or by CITY
    SWITCH Criterion
    CASE "City": RESULT Customer.City
    CASE "Name": RESULT Customer.Name
    END
See also
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