BackPrevious Page Next PageNext

Developing Reports from Hierarchical Data Sources

Example 1: Developing a report from an HDS with dynamic XML URI

Example 2: Developing a report from a parallel HDS

Hierarchical data sources can only be used to create page reports. When you use hierarchical data sources to create reports, you need to be aware of its limitations and unique features. For example, reports created from an HDS are automatically grouped, and an HDS cannot be directly used to create charts and crosstabs. That is to say, if you want to create a chart or crosstab from an HDS, you will need to put it in a banded object, which is created on the HDS, and make the chart/crosstab inherit the dataset of the banded object.

The document contains two examples about developing reports from HDS.

Example 1: Developing a report from an HDS with dynamic XML URI

  1. Make sure SampleReports.cat is the currently open catalog file. If not click File > Open Catalog to open it from <install_root>\Demo\Reports\SampleReports.
  2. In the Catalog Manager, expand the data source to which to add the HDS.
  3. Right-click the Parameters node and select New Parameter from the shortcut menu.
  4. In the New Parameter dialog, enter a name for the parameter, choose String as the Value Type, and in the Prompt Values box, type in the URI of the XML file from which you HDS will be imported (for details, see Creating a Parameter).
  5. Right-click the data source node in the Catalog Manager, and then select New XML Hierarchical Data Source.
  6. In the New XML Hierarchical Data Source dialog, type @ParameterName in the XML URI box. For example, if you named the parameter in step 2 as XML_URI, here you should enter @XML_URI. In the XSD URI box, specify the URI of the corresponding XSD file. Click OK to add the HDS.
  7. Create a page report with the imported HDS. When you view the report, enter the URI of the XML file which matches the XSD file in the parameter. The report then shows the corresponding data.

You can also use another way to develop report with dynamic XML URI as explained below:

  1. In the Catalog Manager, import an XML HDS with an XSD file, and then create a report with the imported HDS.
  2. Create a parameter using the above method.
  3. In the Catalog Manager, go to the node of the imported HDS, expand the Properties sheet, and then change the property URI to @ParameterName.
  4. Now you can view the report with dynamic XML file.

Example 2: Developing a report from a parallel HDS

Data in a parallel HDS is organized in a tree structure, which contains branches and leaves. Among these branches, there are some parallel branch nodes that split the trunk of the data source tree into deeper and more complex branches. The following is a figure illustrating the parallel HDS structure.

HDS structure diagram

The way of using a parallel HDS is the same as with general HDS in JReport Designer. However you should take note of the following when building reports from parallel HDSs.

Groups in parallel HDS

When you insert a group-by field, its children will also be inserted.

The parallel structure in the parallel HDS is represented as groups in JReport Designer, so when you develop a report from a parallel HDS, it will automatically be grouped. By default, JReport Designer will use the first found field as the group-by field. Note that you can neither add a new group-by field nor remove the group-by fields that are automatically added. However, if there is more than one field available to with which to group the sub-tables, you can replace the group-by field with one of the other available fields.

Rules for inserting an object

Notes:

BackPrevious Page Next PageNext