Using cube elements

After a report has been built and published to JReport Server, you can open it in Page Report Studio and use the Resource View panel to analyze data of the report by dragging cube elements from the panel to the component (banded object, table or crosstab) in the report, provided that the data objects used by the component can be converted to corresponding cube elements (see the note in Analytic reporting for details).

Tip: To display the Resource View panel, click Menu > View > Resource View or the Resource View button on the View toolbar. You can use the search bar at the top of the panel to search for any desired resource in a fast and convenient way.

The following examples show how to analyze reports using cube elements. These examples are based on the WorldWideSalesRC report cube in Data Source 1 of the SampleReports catalog. The report cube contains thirteen dimension objects (City, Country, Customer Name, Region, State, Territory, Sales Month, Sales Quarter, Sales Year, Category, Product ID, Product Name, and Product Type), eleven detail information objects (Address 1, Country, Customer Name, CustomerCityStateZip, Phone, Cost, Discount, Order Date, Quantity, Total, and Unite Price), and three measure objects (Total Cost, Total Quantity, and Total Sales). Total calculates the value of the formula ("Unit Price" * Quantity - "Unit Price" * Quantity * Discount/100), Total Sales defines an aggregate function Sum on the formula Total, Total Cost is Sum on Cost, and Total Quantity is Sum on Quantity.

Example 1: Analyzing a banded report

  1. In Page Report Studio, design a banded report titled Sales in China on WorldWideSalesRC, which shows the fields Product ID, Country, Product Name, Unit Price, Quantity, and Discount, and applies the ClassicBlue style.

First, we will apply a filter to the banded object to narrow down data scope.

  1. Click the Filter button on the Analysis toolbar. In the Filter dialog, define the filter as COUNTRY = 'China'.

We want to further sort the banded object by Product Name ascending.

  1. Right-click any of the Product Name values and select Sort > Ascend from the shortcut menu.

  2. As the banded header panel holds no data, we can hide it by right-clicking it and selecting Hide from the shortcut menu.

    Now the report shows as follows:

Next, we will add the Total field to the banded object and group by the City field.

  1. Click the Resource View button on the View toolbar, then resources of the report cube the banded object uses will be shown in the panel.
  2. From the Resource View panel, drag the detail information object Total in the Orders Detail category to the detail panel of the banded object.

  3. Drag the dimension object City in the Customers category to the banded page header panel, when a blue line appears, release the mouse button.

  4. Finally, drag the measure object Total Sales in the Orders Detail category to the group footer panel.

  5. We can now analyze the data in various ways. For example, if we want to see the sales by category instead of city, right-click on any of the City fields and select Drill To > Category from the shortcut menu, then we can see the same report with an entirely different view of the data.

Example 2: Analyzing a crosstab report

  1. Design a crosstab report on WorldWideSalesRC showing product sales information with Product Type (Ascend) as the column field, Category (Ascend) as the row field, and Total Cost as the aggregate field. Apply the ClassicBlue style to the crosstab.

First, we want to replace the product type information with region information, and display the total sales of each product category in each region.

  1. Remove Product Type from the crosstab by pointing to the header Product Type (Decaf or Regular), then dragging it outside the report page. A message box will prompt you whether or not to remove the field. Click OK to confirm, and we can see that the crosstab no longer contains the Product Type information.
  2. Click the Resource View button on the View toolbar, then resources of the report cube the crosstab uses will be shown in the panel.
  3. Drag the dimension object Region in the Customers category from the Resource View panel to the crosstab until a blue line appears indicating the group level of the dimension.

  4. Drag the measure object Total Sales in the Orders Detail category to the aggregate area of the crosstab.

    Now the total sales of each product category in each region is displayed.

  5. Then we would like to see the territory information for the EMEA region. Click in the EMEA header and we will drill down to the next lower level based on the hierarchy defined in the report cube which in this case is Territory.

    Using the same way, we can further drill down to the country, then the city levels which have been defined in the hierarchy to get detailed sales information in each city. For more details about drilling, refer to Automatic drilling.

Example 3: Analyzing a table report

For a table, you can analyze its data in the same way as for a banded object. Furthermore, Page Report Studio provides some analysis methods specific for tables.

  1. Design a table report on WorldWideSalesRC, which shows the fields Product Type, Country, Product Name, Unit Price, Quantity and Discount, and applies the ClassicBlue style.
  2. Add a filter COUNTRY = 'China' AND PRODUCT TYPE = 'Decaf' to the table (see Example 1 for details on filtering). The table displays as follows:

For a table, we can insert a column (or row for horizontal table) at a specific position. So next, we will insert the dimension object City into the table.

  1. Click the Resource View button on the View toolbar, then resources of the report cube the table uses will be shown in the panel.
  2. Drag City in the Customers category from the Resource View panel to the boundary between the first column (Product Type) and the second column (Country) in the table until a blue line appears.

    The report result will be regenerated.

    Tip: When you add a column to a table, if the width of the table exceeds the defined page size, you will be prompted whether to allow JReport to adjust the page size automatically so as to place the column. Click Yes in the message box to have the page size adjusted, or No to make the columns in the table compressed. Also, If you do not want to display the message in future, check Don't prompt the message again in the message box, or uncheck Always Prompt Whether to Adjust Page Size Automatically in the Profile > Customize Profile > Page Report Studio > Properties > Default tab. If you choose not to show the message box again, when the table width exceeds the defined page size, JReport will always adjust the page size automatically.

Next, we want to show the total information and remove the product name information. This can be done with a single drag-and-drop.

  1. Drag the detail information object Total in the Orders Detail category to the header Product Name until the label Product Name is highlighted in a blue background.

    Now, the total value for each record will be generated.

As a table column can contain more than one field, next, we will add the measure object Total Sales to the Total column.

  1. Drag Total Sales from the Resource View panel to any value in the Total column.

    The report result will be regenerated.

    Here 182,298.76 is the sum of all total values. In this way, the title for the added field will not be automatically created.

At last, we want to change the order of the Total and Discount columns in the table.

  1. Drag the label Total to the right of the Discount column, when a blue line appears along the right boundary of the Discount column, release the mouse button.

    We can see that order of the columns changes.

Notes: