Adding Special Characters for Sorting Reports

Instead of using a ORDER BY statement in your free type SQL, you can use sort criteria in the report design, similar to setting up a filter. The query in this example uses an ORDER BY statement to sort employees by salary. To override this sort in the report, you must add the special Begin Order and End Order statements immediately before and immediately after the ORDER BY clause. You can use the Insert Special button to add the statements, or type them in manually.
 Free Type query with --$beginorder and --$endorder lines inserted around the ORDER BY clause

Place the cursor at the desired location, then insert the special character strings and the ORDER BY statement. SQL statements between --$beginorder and --$endorder will be replaced by the ORDER BY statement created as a result of the sort criteria in the report design.

These special characters must be placed at the appropriate location within the query and surround the ORDER BY statement.  The statements surrounded will be replaced by the ORDER BY statement created in the report.