## Lesson 3: Performing data analysis on dynamic reports

The previous lesson described how to perform data analysis on ad hoc reports. However, data analysis can also be performed on published dynamic reports, that is to say, the DHTML format reports built in JReport Designer. For dynamic reports to support data analysis, the components in the report must have a report cube built in the same query with the component. The report cube must reside in the same published catalog with the dynamic report.

Take the banded object created in Lesson 8 of Trail 2 for example, it has a group field Orders_Order ID and four detail fields Customer Name, Order Date, Last Name and Payment Received, and the banded object is based on the OrdersReport dataset which originates from the OrdersReport imported SQL file. As you know from Lesson 2 of Trail 3, this imported SQL file contains the report cube OrdersReport_ReportCube. The report cube includes the dimension objects Order ID, Name, Sales Date, Last Name, and the detail information object Payment Received, which correspond to the group field and detail fields of the banded object respectively, in other words, the fields in the banded object can be mapped into the corresponding cube elements.

This lesson guides you to perform data analysis on the banded object.

1. On the JReport Console > Reports page, click My Reports > JinfonetGourmetJava, and then click the OrdersReport.cls link to open the report set.

First we will adjust the structure of the banded object.

1. Right-click the panel which the subreport (chart) is inserted in, and then on the shortcut menu, click Hide to make the subreport invisible.

2. Right-click any value of the Customer Name field and then select Delete from the shortcut menu to delete the field. Then do the same to the fields Order Date, Employee Last Name and Payment Received. Correspondingly, delete the four name labels.

   In another way, you can drag any field value outside the report page and drop it, and then click OK to confirm the removal in order to delete the field.

   Now the banded object only shows order ID information.

3. Right-click the group header panel containing the Order ID field, then select Properties from the shortcut menu.
4. In the General tab of the Banded Panel Properties dialog, set the Height property to 0.21 and click OK.

   Now the banded object looks like:

5. Select the banded object by clicking anywhere in it, and then a cross-arrow appears at the upper left corner of the banded object. Right-click the icon and then select Show > DetailPanel from the shortcut menu to show the detail panel of the banded object which was hidden when designing in JReport Designer.

Next, we use the Resource View panel to perform data analysis.

1. Switch to the Interactive View mode by clicking the link on the toolbar, then click Menu > View > Resource View to show the Resource View panel.
2. Expand the Orders Detail category of OrdersReport_ReportCube, drag Unit Price to the detail panel and drop it.

3. The Convert Data Fields dialog appears. This dialog only appears for the first time you perform data analysis on a component designed in JReport Designer. Click OK to confirm, and the Unit Price information will be presented in the banded object.

4. Now add the dimension object Quantity and detail information object Discount in the OrdersReport_ReportCube to the detail panel in the same way.
5. Drag the measure object Total Sales to the group header panel and drop it. The result will be:

6. Adjust the objects in the report to make it tidy with the methods mentioned in the previous lesson, and then we can get:

Next, we will group the banded object further by customer name and do some drill actions.

1. Expand the Customers category of OrdersReport_ReportCube in the Resource View panel, drag the Name dimension object to the upper part of the Order ID group header panel and drop it when a blue line appears.

2. Modify the group field properties and hide its group footer panel using the way we mentioned in the previous lesson, and the result will become:

3. Right-click any customer name (Cafe Kenya for example), then select Drill To > Category. The banded object becomes:

4. In this report, there is a hierarchy Products defined in the report cube, which is from Category to Product Name (higher to lower), so we can drill a category down to the products in it. For example, right-click Blends and select Drill Down > Product Name, and then we get: