Embedding Data Components in a Banded Object
Data components, including banded objects, tables, charts, crosstabs and geographic maps can be embedded inside a banded object. The embedded data components can have their own datasets or inherit the dataset from the parent, and when they inherit the parent's dataset, the report becomes powerful. For example, if you want a child data component to be automatically filtered by the group of the parent banded object, you can put the child data component in the group panel in the banded object and make it inherit dataset from its parent, then the child data component will be replicated for each group in the parent. Moreover, by embedding a chart in a banded object and having it inherit the dataset from the parent, you can make the chart a dynamic chart in Excel.
However, when a data component is to be inserted into the Detail (DT), Banded Page Header (BPH) or Banded Page Footer (BPF) panel of a banded object, you cannot make the data component inherit dataset from the parent.
Suppose you want to have a chart to give to each country showing the annual sales of each product category for the country, you can create the report as follows:
- Make sure SampleReports.cat is the currently open catalog file. If not select File > Open Catalog to open it from
<install_root>\Demo\Reports\SampleReports
. - Create a page report with a banded object in it based on the query WorldWideSales in Data Source 1 and grouped by the field Country.
- Select the Country group-by field and in the Report Inspector set its properties Foreground, Bold and Font Size to 0xff0000, true and 10 respectively.
- Right-click the banded header panel (BH) and select Hide from the shortcut menu to hide it.
- Repeat the above step to hide the panels BPH, DT, GF, BPF and BF that do not contain any data.
- Resize the group header panel (GH), drag and drop from the Components panel to the group header panel below the Country group-by field.
- In the Create Chart wizard, define the chart as follows:
- Use the current dataset WorldWideSales used by its parent.
- Display in the default chart type Clustered Bar 2-D.
- Show the summary Sum_AnnualSalesbyCountry on the value axis (the field Country is added automatically as the category field), Category as the series field.
The chart is embedded into the banded object as follows in the design area:
- Save the report and select the View tab to preview it. The annual sales for each product category in each country are filtered in the chart according to the group-by field Country in the banded object.