PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • The different sort criteria
  • Adding a sort criterion
  • How to proceed?
  • Modifying a sort criterion
  • Modifying a sort criterion in a report based on a data file or on a memory zone
  • 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/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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 city then, for each city, 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.
    See Sort procedure for more details.
  • 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.
Note: 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.
Note: If the report is based on a query, a sort criterion can also be added from the query editor. See Sorting the query records for more details.

How to proceed?

  1. To add a sort criterion:
    • in a report currently created, display the wizard step specific to the sort criteria.
    • in an existing report, select "Report .. Edit the sorts". The list of sort criteria is displayed.in an existing report, on the "Modification" pane, in the "Report" group, click "Edit the sorts". 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( )").
      See Sort procedure for more details.
    • 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.
Notes:
  • 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 zone

To modify a sort criterion in a report based on a data file or on a memory zone:
  1. To modify a sort criterion:
    • in a report currently created, display the screen specific to the sort criteria.
    • in an existing report, select "Report .. Edit the sorts". The list of sort criteria is displayed.in an existing report, on the "Modification" pane, in the "Report" group, click "Edit the sorts". 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( )").
      See Sort procedure for more details.
    • 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. Select "Report .. Edit the sorts". The list of sort criteria is displayed.On the "Modification" pane, in the "Report" group, click "Edit the sorts". 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.
Note: The sort direction of a criterion can also be modified from the query editor. See Sorting the query records for more details.
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.
Note: 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 currently created, display the screen specific to the sort criteria.
    • in an existing report, select "Report .. Edit the sorts". The list of sort criteria is displayed.in an existing report, on the "Modification" pane, in the "Report" group, click "Edit the sorts". 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 zone. This procedure can be used to modify the sort criteria dynamically.
To implement a sort procedure:
  1. Select "Report .. Edit the sorts". The list of sort criteria is displayed.On the "Modification" pane, in the "Report" group, click "Edit the sorts". 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:
    PROCÉDURE SortVal(Criterion)
    // Sort by NAME or by CITY
    SWITCH Criterion
    CASE "City": RESULT Customer.City
    CASE "Name": RESULT Customer.Name
    END
See also
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment