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), BandedPageHeader (BPH) or BandedPageFooter (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:
- Open the Catalog File SampleReports.cat in
<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 set its properties Foreground, Bold and Font Size to 0xff0000, true and 10 respectively in the Report Inspector.
- 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 Chart from the Component to the panel below the Country group by field.
- In the Data screen of the Create Chart wizard, check the Current radio button, the query WorldWideSales is selected by default, then select Next.
- In the Type screen, keep the default chart type Clustered Bar 2-D and select Next.
- In the Display screen, add the summary Sum_AnnualSalesbyCountry to the Show Values box. The field Country is then added automatically to the Category box.
- Add the field Category in the Products table to the Series box, then select Finish (for more information about creating a chart, select here).
- The chart is embedded into the banded object and the report displays as follows:
- Save the report and select the View tab. 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.