## Predefining sort and filter conditions

You can predefine some sort and filter conditions for data components, which refer to banded objects, tables, charts and crosstabs, in reports, so that when the reports are published to JReport Enterprise Server and are loaded in JReport Web, data in the components will be displayed in the order you prefer, or be narrowed down as you desire.

### Predefining sort conditions

To predefine sort conditions for a data component, follow the steps below:

1. Select the component to which the sort conditions will apply.
2. Click Report > Edit Sort and Filter to show the Edit Sort and Filter dialog. The Sort tab is active by default. See the tab.

3. In the Fields panel, all the fields in the dataset the component uses are displayed. Select the field by which to sort the data from the panel and click to add it to the Sort By panel. To sort by two or more fields, select all of them and then click .
4. To modify the sorting direction for a field, select (ascending) or (descending) in the Direction column.
5. To change the sorting priority of the fields, select the field in the Sort By panel, and then click or to move it up or down.
6. Click OK to accept the settings.

### Predefining filter conditions

To predefine filter conditions for a data component, follow the steps below:

1. Select the component to which the filter conditions will apply.
2. Click Report > Edit Sort and Filter to show the Edit Sort and Filter dialog, then switch to the Filter tab. See the tab.

3. Click the Add Condition button to add a condition line.
4. From the field drop-down list, select the field on which the filter will be based.
5. From the operator drop-down list, set the operator with which to compose the filter expression.
6. In the value combo box, type the value of how to filter the field or select the value from the drop-down list.
7. Click Add Condition to define another condition line and set the relationship between the two lines if required.
8. When done, click OK to apply the settings.

See also Edit Sort and Filter dialog for details about options in the dialog.

Notes:

- If the Customize Display Name feature hasn't been applied to the dataset on which the component is created, when you open the Edit Sort and Filter dialog, there will be no fields displayed either in the Fields panel of the Sort tab or the field drop-down list in the Filter tab, in which case, you need to click the Edit Display Name button in the dialog first to enable the feature on the dataset. You can also modify the display names in the Edit Display Name dialog if desired.
- The predefined sort and filter conditions will neither affect the preview result in JReport Designer, nor the result produced from being run in formats other than DHTML.