Previous Page Next Page
Example 3: XML File with Dynamic Parameters
Importing the XML file directly using the Model Wizard
Importing the ODF file into a catalog
When you design a report from the tables imported through OOJDBC, and the tables have the same input parameters, but you don'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 an XML file with the Model Wizard, take the following steps:
- Run ModelWizard.bat in
<install_root>\bin
to open the Object Source Wizard.
- 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.
- 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 Manager.
- The same ODF file cannot exist in
both <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:
- Start JReport Designer.
- Click File > New Catalog.
- In the New Catalog dialog, specify the catalog name, the data source name and the path. 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
.
- In the Catalog Manager, create a parameter in an existing catalog data source that is of String data type and is named path. This parameter will be bound to the parameters in the tables that were imported through OOJDBC.

- Right-click the node of the same catalog data source and select New JDBC Connection from the shortcut menu. Click JDBC in the Select Connection Type dialog.
- In the Get JDBC Connection Information dialog, enter com.jinfonet.jdbc.obj.ObjectDriver in the Driver text field, type jdbc:jinfonet:object:@Filename in the URL text field. @Filename should be the ODF file name. In the example, it is jdbc:jinfonet:object:@xmlparam.

- Click OK to set up the connection.
- In the prompted guidance dialog, click Add Tables.
- The Add Tables/Views/Synonyms 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.

- 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.
- Create a report on the newly inserted tables.
- 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:
- In the Catalog Manager, 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.
- Highlight the parameter in the catalog, and then select the parameter from the drop-down list to bind it to the parameter in OOJDBC.
Previous Page Next Page