Defining hierarchies
Hierarchies can be defined in a business view to allow users to drill report data up and down to particular groups on JReport Server. A hierarchy is defined as a hierarchy category holding one group of group objects sharing a hierarchical relationship, following the order from the highest level to the lowest. For example, these group objects can be added into one hierarchy group called Dates: Sales Year, Sales Quarter, Sales Month, and Sales Date. When any of these group fields are used for grouping data in a table, crosstab or chart, end users can use the context menu to drill up or down to the next level. You can create any number of hierarchies such as dates, times, geography, product types, etc.
The group objects added in a hierarchy are just references to the real group objects and therefore cannot be edited.
To define hierarchies in a business view, you can take either of the following two ways:
Defining a data hierarchy in the Business View Editor
- In the Catalog Browser resource tree, select the business view, right-click it and click Edit Business View on the shortcut menu.
- In the Business View Editor, select the business view or any category in the Business View panel, then,
- Right-click and select Add Hierarchy from the shortcut menu.
- Click Insert > Hierarchy on the menu bar.
- Click the Insert Hierarchy button on the toolbar.
- In the Add Hierarchy dialog, provide a name and click OK. The name should be unique among the hierarchies in the business view.
- A blank hierarchy will be added to the business view resource tree. You can then add group objects into the hierarchy as a hierarchical group by dragging and dropping.
- Drag a group object either from the query resource tree in the Resource Objects panel or from the business view resource tree in the Business View panel and then drop it into the hierarchy. The inserted position depends on the dropped position:
- When you drop on the hierarchy root node, the group object will be placed to the bottom level of the hierarchy.
- When on an existing level, the group object will be placed below it.
- When between two levels, the group object will be placed between them.
-
To adjust the order of the group objects in the hierarchy, make use of the or button. The higher the position is, the higher the level is.
-
To remove a group object from the hierarchy, select it, then right-click and select Remove from Hierarchy on the shortcut menu.
Adding a data hierarchy in the Data tab of the Catalog Browser
- In the Catalog Browser resource tree, right-click the business view or any category in it and select Add Hierarchy from the shortcut menu.
- Provide a name in the Add Hierarchy dialog and then click OK. The name should be unique among the hierarchies in the business view.
- A hierarchy will be added in the business view.
- Follow the steps 5 to 7 in the above section to define the hierarchy in the Business View Editor.
Tip: Hierarchies can be added into any category in a business view and it does not make any difference where it is placed. For easy look-over, you can put them under the root category.