##### Example 3: XML file with dynamic parameters

When you design a report from the tables imported through OOJDBC, and the tables have the same input parameters, but you won't want to input the same parameters again, JReport provides a way to allow you to bind parameters in a catalog, so they can share the same parameter value.

This example demonstrates how to import tables with dynamic parameters from the ODF file generated by the Model Wizard.

###### Importing the XML file using the Model Wizard

To import a XML file with the Model Wizard, take the following steps:

1. Run ModelWizard.bat in `<install_root>\bin`. The Object Source Wizard will then appear.
2. Add two tables as shown in Example 1. The first table named employee1 has one String type column, and the second table named employee2 has one Int type column. They have the same input parameter for param0. The default value is `h:\xml\employee.xml`. Make sure to check the option Is dynamic.
3. In the Object Source Wizard, click File > Save. You will then be prompted to save the ODF file. You should save it to `<install_root>\lib` or the directory where the catalog will be. Here we save it as xmlparam.odf.

Notes:

- If you choose the option Is Dynamic, this parameter will be passed to JReport Designer. After you create a new connection, you will find this parameter in the node Parameters in the Catalog Browser.
- The same ODF file cannot both exist in `<install_root>\lib` and the directory where the catalog is to be located.

###### Importing the ODF file into a catalog

To import the generated ODF file into a JReport catalog, take the following steps:

1. Start JReport Designer.
2. Click File > Catalog Management > New Catalog.
3. In the Input New Catalog Name dialog, specify the catalog name and path.

   Note: The catalog should be located in the directory where you saved the ODF file. For example, if you saved the ODF file in `C:\odf`, the new catalog should be created also in `C:\odf`.

4. In the Catalog Browser, create a parameter named path that is to be bound to the parameters in the tables that were imported through OOJDBC. See illustration.

5. Create a new connection in the Get JDBC Connection Information dialog. See illustration.

6. The Add Table dialog appears prompting you to add the listed tables. Select the table employee1 and click the Add button. The Dynamic Parameter used in oojdbc tables dialog will then be displayed. Uncheck the checkbox in the New column and select the parameter path from the drop-down list to bind param0 to the parameter path. See illustration.

7. Repeat the above step to add the employee2 table and bind its parameter param0 to the parameter path. Now the parameters in the two tables will share the same parameter path.
8. Click the New Report Set button on the Standard toolbar to develop a report on the newly inserted tables.
9. When viewing the report, the Enter Parameter Values dialog will be displayed, asking you to input the parameter. You will only need to input the path of imported XML file once since the parameter is shared with the parameters in the two tables.

###### Modifying the dynamic parameters

You can modify the links between the parameters in OOJDBC and parameters in the JReport catalog. To do this:

1. Launch the Catalog Browser in JReport Designer.
2. Select the table with the dynamic parameters that are to be modified. Right-click on the specified table, and then select Parameters from the shortcut menu.
3. Highlight the parameter in the catalog, and then select the parameter from the drop-down list to bind it to the parameter in OOJDBC.