## Managing datasets

After you have created some datasets in a report, you can manage them according to your requirements, for example, you can add data fields to a dataset or filter the dataset. To do this, click Report > Dataset Management on the menu bar, and the Dataset Management dialog appears, in which you can manage your datasets as required. See the dialog.

### Adding/Removing data fields in a dataset

You can add additional data fields to a dataset as long as they come from the source on which the dataset is created, or remove some unnecessary data fields from a dataset. To do this:

1. In the Dataset List box of the Dataset Management dialog, select the dataset you want to edit.
2. In the Data tab of the dialog:
   - To add more data fields to the dataset, from the Available Resource box, select the fields and then click to add them to the dataset.
   - To remove an unnecessary data field from the dataset, select it in the Dataset box and click . Only the fields which are not used by any data component created on the dataset, either directly or indirectly, can be removed. To remove all the data fields in a dataset, click , however, when you click the button, only the unused data fields will be removed actually. When you enter the dialog the next time, you will find that the data fields used by data components created on the dataset will still display in the Dataset box.
3. When done, click OK to apply the changes and close the dialog box.

### Filtering data fields in a dataset

1. In the Dataset List box of the Dataset Management dialog, select the dataset with the data fields you want to filter, then click the Filter tab.
2. Click the Add Condition button to add a condition line.
3. In the field text field, specify the field on which the filter will be based.
4. From the operator drop-down list, set the operator with which to compose the filter expression.
5. In the value text field, specify the value of how to filter the field.
6. To add another line of filter expression, click the Add Condition button and define the expression as required. Then from the logic drop-down list, specify the relationship between the two filter expressions.
7. Repeat the above steps to add more filter expressions if necessary.

   To make some conditions grouped, select them and click the Group button, then the selected conditions will be added in one group and work as one line of filter expression. Conditions and groups together can be further grouped. To take any condition or group in a group out, select it and click Ungroup.

   To adjust the priority of the conditions, select it and click the Up or Down button.

   To delete a condition line, select it and click the Delete button.

8. When done, click OK to apply the changes and close the dialog.

Tips:

- You can also add/remove the data fields in a dataset or filter a dataset while creating a data component with wizard. To do this, check the Existing radio button in the Data screen of the wizard, then select an existing dataset and click the Modify button. In the Dataset Editor, edit the dataset as required.
- A dataset can also be filtered using the Dataset Filter dialog, which is displayed by clicking the Dataset Filter button on the toolbar of the Resource View panel.
- You can use parameters to dynamically filter datasets as you do with queries. For details about parameter's usage on this, refer to Dynamically filtering queries.

Note: The following SQL type of data cannot be sorted: Db.SQL_BINARY, Db.SQL_BLOB, Db.SQL_CLOB, Db.SQL_LONGVARCHAR, Db.SQL_LONGVARBINARY, Db.SQL_VARBINARY and Db.SQL_OTHER.

### Optimizing a dataset

You can enlarge or decrease the scope of retrieved data for a dataset, and therefore make a balanceable decision between better performance and special usage cases/demands. To do this:

1. In the Dataset List box of the Dataset Management dialog, select the dataset with the name you want to optimize.
2. Click the Optimize Dataset button.
3. In the Optimize Dataset dialog, choose a retrieved data scope for the dataset.
   - Only Columns Used in Report
     Only data columns used in the current report are retrieved at runtime. This way ensures the best performance since the least data is retrieved.
   - All Columns in Dataset
     All data columns defined in the dataset are retrieved at runtime.
   - All Columns in Query
     All data columns in the query that the dataset is based on are retrieved at runtime. The performance of this way is not as good as the other two.
4. Click OK to apply the settings and close the dialog.

### Renaming a dataset

1. In the Dataset List box of the Dataset Management dialog, select the dataset with the name you want to modify.
2. Double-click the Name cell of the dataset.
3. Input a new name in the cell and press Enter to apply the changes.

   However, you are not recommended to rename a dataset that has been used by other data components randomly. Renaming a referenced dataset may cause data components based on the dataset not to work.

### Removing a dataset

After you have created one or more datasets in a report, you can choose to remove them if they are no longer required for the report. To do this:

1. In the Dataset List box of the Dataset Management dialog, specify the dataset you want to remove.
2. Click the Remove button to remove the specified dataset.
3. When done, click OK to apply the changes and close the dialog.

   However, if you remove a dataset directly in this way, any data components created based on the dataset will not work. So, when you want to remove a dataset, it is recommended that you first remove the data components which reference this dataset.