Filter and Sort the Data

When you first create the report (or edit an existing report) you see the Edit Report dialog box shown below containing the Filters and Sorts tabs.

The Edit Report dialog with Example CSV Report entered as the Report Name.

Contact your DataBlock Designer if you receive the following pop-up message when using the Filters or Sort Tabs: 

“To use this feature edit the DataBlock and insert special character sequences into the Free Type SQL so Argos will know where to place the overrides at runtime" 

Filters

The Filters tab allows you to activate additional data filters at the report level rather than having to modify the WHERE clause of the DataBlock's report query.

The Edit Report dialog with the Filters tab selected.  With this tab selected, all database fields are listed in the Available fields pane.

To add a filter you need to activate additional filtering by checking the Activate additional filtering box.

Activate additional filters checkbox.

Although filtering in this example is done using only one field, a filter can consist of multiple fields with operators linking them together (=, <, <>, etc.).

You can create filters by selecting the list of fields and filtering them by the operators (+, <, <>, and, or, etc.).   For example to view salaries above 60,000, double-click on Employees.salary, click greater than (>), then enter 60000.  The resulting filter is shown below.

Edit Report dialog with a Employees.salary greater than 60000 entered as the filter.

Click OK and run the report to view the application of the filter.

Sort

Click on the Sort tab to add custom sorting.

Edit report screen with the sort tab selected.

You will need to override the default sorting in order to add your custom sorting. Check the Override the main report query sort box.

Override the main report query checkbox.

Add Employees.dept_id and Employees.salary by selecting them in the Available fields list and clicking the right arrow button Right arrow button to add them to the Ordered fields list.

Edit Report dialog with the Sort tab selected.  The available database fields are in the listbox to the left.  In the Ordered fields pane to the right, the Department I D field is sorted by ascending,  and Salary is sorted by descending.

Sorting Options:Double-click Ascending/Descending to toggle sort by ascending or descending order.

You can sort using multiple fields.  The figure illustrates sorting by department name (ascending), then by salary within the department (descending).

You need to activate sorting by clicking the “Override the main report query sort” checkbox at the top of the tab.

Move items over that you wish to sort on by double-clicking on the item or single-click then clicking the arrow pointing to the right. You can reorder fields by clicking the up or down arrow to the right of the Ordered Fields box. You can change the sort order to ascending and descending by clicking on the double arrows.

Filters and sorts involve editing the report so, once they are turned on, only a Report Writer can deactivate or change them, and Report Viewers cannot. To deactivate a filter or sort just uncheck the activate box. You do not need to clear out the filters and sorts. The Filters tab adds filters to the Report query, so all the conditions and filters in the DataBlock run, and then your additional filters are applied.

Note: If you define a sort order by using the sort tab, you will override the sort order in the DataBlock, so you essentially will be ordering the recordsets twice. The DataBlock will sort based on whatever sort order it is using. When the report is created it will reorder the recordsets based on the report sort order.

After choosing your sort options, click OK then execute the report to see the results.