#### Example 1: Adding a general HDS

JReport Designer provides you with a set of hierarchical data source APIs that allow you to import a customized hierarchical data source.

##### Compiling the source files

There are three classes used in this example. Their source code files are HierarchicalDataSource.java, HierarchicalDatasetMetaData.java, and HierarchicalDataset.java, which are available in `<install_root>\help\designer\samples`. In this example, the HierarchicalDataSource.java will return the result set from the demo hsql db.

1. Store the above three files in `<install_root>\help`. Modify the demo hsqldb path in both HierarchicalDatasetMetaData.java and HierarchicalDataset.java.
2. Compile the Java files to generate HierarchicalDataSource.class, HierarchicalDatasetMetaData.class, and HierarchicalDataset.class.
3. Append the path `<install_root>\help` to the class path that starts your JReport Designer, so that at runtime the HierarchicalDataSource can be found.

##### Adding the HDS to a catalog

After compilation, you can now add the HDS to a JReport catalog.

1. Start JReport with the batch file you just modified and open an existing catalog.
2. In the Data tab of the Catalog Browser, expand the data source to which to add the HDS, then right-click the Hierarchical node, and then select Add General Hierarchical Data Source from the shortcut menu. The Add General Hierarchical Data Source dialog appears. See the dialog.

3. Click the Browse button to find the class HierarchicalDataSource.class.
4. Type a number in the Parameter box. Then, only the records whose employee ID is less than this number will be fetched.
5. Click Load Tree. The data source tree will then be parsed.
6. Modify the column properties in the Columns box as required.
7. Click OK to add the HDS.