Q.4. Report Designer

After setting up data sources and creating queries, the next step to create reports is to take the results of the data source and map them to the report. Depending on the type of report being created, the mapping options will vary. This section only covers basic mapping for certain report layout. Once you will finish data mapping for your report, you will be taken to the Report Designer interface where you can customize many different features/properties of the report. Here in QuickStart, we will use only some of the most commonly used features in the Report Designer. For more information, please see Section 4.1 - Report Designer.

Q.4.1. Report Mapping

This section looks at several ways data can be mapped to the table structure of reports. This section will use the query created in Section Q.3.1.2 - Create a Query as the data source for the report.

Q.4.1.1. Simple Columnar Layout

The simple columnar layout is the most straight forward type of report mapping. Columns from the data source are drawn in a straight table in the report without any grouping and breaks.

To begin creating a report, open your data registry and select the node for your query. Click the VIEW button. A new window will open, with a table containing the results of the query (first 20 records only). Notice that because your query contains a parameter, it initially runs with the default values that were specified when the parameters were initialized.

Query Result Screen

The bottom of the screen contains two buttons, Create Chart and Create Report, which allow you to use the query to design a chart or report. To continue designing the report, click Create Report. This will bring up a dialog asking you which report layout option you would like to use.

Select Report Layout Dialog

From this dialog, select Simple Columnar as the layout and click the Next button. The next step in the Report Wizard allows you to select which columns from the query you would like to use in the report, as well as re-arrange the column order. (Although the column order is not particularly important for the simple columnar layout, it can have a significant impact on other layouts depending on the mapping options selected).

Column Selection/Ordering Dialog

In this dialog, select the following fields for the report:

ORDERID
CATEGORYNAME
PRODUCTNAME
QUANTITY
SALES

Once you have selected the fields, click Next to continue on in the Wizard. The next dialog is the data mapping dialog. This is where you can select how to map the fields from the data source into the selected report layout. This is a simple columnar layout, so the only options are whether to set columns as visible or not and whether to generate a top N presentation.

Data Mapping Dialog

In this dialog, select to leave all the columns visible and do not select the top N option. (For more about top N presentations, please see Section 4.1.2.1.1.1 - Top N Report). Next click the Done button. (There are some optional additional steps in the Wizard which will be explained later in this section). This will bring up the Report Designer interface with an unformatted version of your report.

Click to view larger image

Simple Columnar Report in Design Window

Now click on the Preview Tab in the upper-left hand corner of the window. A dialog will open asking you whether you would like to preview the report with live or saved data.

Preview Data Options

Select the Live Data option and click OK. A parameter selection dialog will appear prompting you to select a start and end date by which to filter the report.

Parameter Value Selection

Specify a range that is large enough to produce enough records and click OK. You will then see the report output. Notice how the simple columnar layout places the columns from the result set in the report directly, without any grouping, sorting, or summaries.

Click to view larger image

Simple Columnar Report Preview

Q.4.1.2. Summary Break Layout

The summary break layout is similar to the columnar layout, except it adds the ability to group and aggregate the report columns. A summary break report must be grouped by at least one column. Using the report created in Section Q.4.1.1 - Simple Columnar Layout, we will convert it into a summary break layout.

Go to the design tab and select the Change Data Mapping Icon on the toolbar . This will return you to the Report Wizard, where we will select a different report layout. From the last data mapping dialog, hit the Back button twice until you get back to the Select Report Format window.

Change the report layout type to Summary Break and click Next. In the next screen, keep the column selection the same and click Next again to go to the data mapping window. You will notice that there are more options in this window than there were for the columnar layout.

Data Mapping Screen for Summary Break Layout

In the data mapping dialog, check the option called Row Break for the first two columns. This will have the report group by those two columns. From the drop-down menus under Aggregation, select to SUM the QUANTITY and SALES columns. Also, uncheck the Apply Template option, as you do not need to carry over the formatting from the simple columnar layout. Once you have finished specifying options, again click the Done button. You will get a warning if you have not applied template. Click Yes to continue. You will be taken back to the Report Designer where the new mapping has taken effect.

Click to view larger image

Summary Break Report in Design Window

In the Designer you will notice that because there are two levels of nested grouping in the report there are now corresponding Group Header and Footer sections for each. For more about report sections and their behavior, please see Section 4.1.3.1 - Report Sections. Now click on the Preview tab to preview the report. Again, you will be prompted to specify parameter values. Once you see the report in the preview window, notice that the data is grouped by category name and order ID and that intermediate summaries are calculated for each group.

Click to view larger image

Summary Break Report Preview

Q.4.1.3. Crosstab Layout

A crosstab report shows data in a matrix-like form, allowing multi-dimensional data to be displayed in a two-dimensional layout. In the current example, we will use the crosstab layout to breakdown the sales column by product category and region.

Go to the design window and select Change Data Mapping . When the Report wizard re-opens, click the Back button until you get back to the layout selection screen. From this screen, select to use a CrossTab layout and click Next. At the column selection/ordering screen (next in the Wizard), change the selection to be the following:

CATEGORYNAME
REGION
SALES
Click to view larger image

Column Selection for Crosstab Report

Once you have specified the columns in the correct order, click the Next button to bring up the data mapping option for the crosstab layout.

Click to view larger image

Data Mapping Screen for Crosstab Layout

For the CATEGORYNAME column, check the option marked Row Break. This will create a row in the report data for each distinct category name. Next select the Column Break option for the REGION column. This will create a column in the report data for each distinct region. Leave the Order option as not sorted. Finally, select the Column Break Value option for the SALES column and click on the Aggregation menu to select SUM. This will give you the total sales for each category and region in the report.

Once you have finished specifying the options, click the Done button to go to the Report Designer. You will get a warning if no template was applied. Click Yes to continue.

Click to view larger image

Crosstab Report in Design Window

Now click on the Preview tab to preview the crosstab layout. As you can see a report column has been generated for each region, and has been automatically totaled both vertically (columns) and horizontally (rows).

Click to view larger image

Crosstab Report Preview

Q.4.1.4. Master & Details Layout

Like the summary break layout, the master & details layout also allows you to group the data. It also allows you to automatically add column fields to the Group Header section, creating a one to many layout that can also be configured in a side-by-side layout.

Go back to the design window and select Change Data Mapping from the Data menu. Again, navigate back to the layout selection screen. This time select the Master and Details layout. Click Next to get to the column selection screen. In the column selection screen, change the selection to include the following columns:

ORDERID
COMPANY
QUANTITY
PRODUCTNAME
UNITPRICE
SALES
Click to view larger image

Column Selection for Master & Details Report

Once you have specified the columns in the correct order, click the Next button to bring up the data mapping dialog for the master & details layout.

Click to view larger image

Data Mapping Screen for Master & Details Layouts

Select the ORDERID field as the Primary Key from the drop-down menu in the lower-left hand portion of the screen. This will group the data by the ORDERID field. Next, check the Master Field option for the COMPANY column. This will place the COMPANY field in the Group Header section of the report.

Instead of clicking Done to get to the Report Designer from this screen, click the Next button to invoke the additional pre-formatting options. You will get warning that all the formating will be lost. Click Yes to continue to the dialog that allows you to add several elements to the report.

Add Report Elements Dialog

Check the boxes to add a Report Title, Page Number and Date. Enter the text you would like as the report title and specify the format and location of the date and time using the drop-down boxes for each option. Once you have finished setting the options, click Next. A new dialog will open allowing you to specify a style for the new report.

Click to view larger image

Report Style Selection

Select the Block Left-Align style and click the Done button. You will be taken to the Report Designer window, where the elements have been added. There is now some default formatting applied to the report.

Click to view larger image

Master & Details Report in Design Window (with pre-formatting)

As you can see the ORDERID and COMPANY fields have been generated in the Group Header section. Now preview the report, and you will see a group with each order, as well as the page number and date in the section (header or footer) in which they were placed.

Click to view larger image

Master & Details Report in Preview Window

Now that you have finished creating a report, click the Save button on the toolbar to save the report . This will bring up a new dialog, allowing you to specify save options for the report.

Save As Dialog

Enter a name for the report and click Ok. By default the report will be saved in the /ReportFiles/ directory under the ERES install directory. A dialog will open, asking you if you would like to insert the report in the Organizer, and what folder do you want to choose.

Save to Organizer Prompt

Click Yes and the report will be added to your project in the Organizer.

Q.4.1.5. Mailing Labels Layout

A mailing labels layout is similar to a simple columnar layout; however, it prearranges data in a manner that allows you to create mailing labels.

Close the design window and go back to the data registry to start designing a report. Navigate to Invoicing data view. Click the View button to create a new dataview query. Select the following fields from shipping info to the query:

Ship To
Ship Address
Ship City
Ship State
Ship Zip

Specify a name for the query, then click OK. The query result show up:

Click to view larger image

DataView Query Result for Creating Mailing Labels Report

click the Create Report button and select the Mailing Labels layout. The next screen is to select columns to the report, click ADD ALL:

Column Selection for Mailing Labels Report

Once you have specified the columns in the correct order, click the Next button to bring up the data mapping dialog for the maling labels layout.

Data Mapping Screen for Mailing Labels Layouts

Click theDone, You will be taken to the Report Designer.

Click to view larger image

Mailing Labels Report in Design Window

We don't need the left columns in Mailing Label Report. We select all the left columns:

Click to view larger image

Mailing Labels Report Edit in Design Window

And remove them. We continue to edit the report to get general mailing label appearance:

Click to view larger image

Mailing Labels Report Appearance in Design Window

Now click on the Preview tab to preview the Mailing Labels layout.

Click to view larger image

Mailing Labels Report in Preview Window

Now go to the Report Designer window, and select Exit from the File menu to close the interface. We want to save the report, so select Yes in the prompt and specify the name for the new-created Mailing Label Report.

Q.4.2. Basic Report Formatting

In this section, we will open an unformatted template and use some of the basic formatting features in EspressReport to create a polished presentation. To begin formatting the report, you will first need to add the template to the Organizer.

Q.4.2.1. Add a Report Template to Organizer

If you do not have the Organizer open, open it. Then select your project in the left-hand side. Next, click the Insert File button on the toolbar . A new dialog allowing you to select a file to insert into the Organizer.

Insert File Dialog

In the dialog, click the Browse button, navigate to help/quickstart/templates/, and select QuickStart51.rpt. The display name and corresponding URL should be automatically filled in if you have set the URL mapping correctly(Section 2.1.5 - URL Mapping). Click OK to add the report. The dialog will close and you will see an entry in the Organizer for the newly added report.

Click to view larger image

QuickStart51.rpt in the Report Designer

Q.4.2.2. Move and Align Report Elements

Report elements can be moved one by one, by click and dragging the cell. Report elements can also be moved as groups. To move a group of elements you must first select the group using a selection box. To activate the selection box, left-click on the report and drag the mouse to draw a box around the report columns. They should become highlighted when you release the mouse button. To add some more elements to your current selection, press the CTRL key and click again, or draw another selection box while holding the CTRL key.

Click to view larger image
Click to view larger image

Drawing a Selection Box in Report Designer

Once the fields in the report have been selected, click and drag to indent them about half an inch. Next, click the Left Alignment button on the toolbar . This will align all of the cell text to the left edge of the cell.

Q.4.2.3. Data Formatting

There are a number of options available that allow you to control how data will be displayed (date format, decimal places, rounding, etc). Using the selection box again, select the UnitPrice, and StainPrice columns (just the column fields not the headers).

Click to view larger image

Two Column Selection

Once the columns have been selected, select the Data Format option from the Format menu. This will open a dialog prompting you to select which data type you would like to set the format for. Select Numeric Format and click Select.

Data Type for Formatting Dialog

This will open a new dialog. From this dialog select Fixed Point and click the Format button. At the next dialog select to have two decimal points and select the dollar sign as the Units symbol.

Numeric Format Dialogs

Click OK and OK again at the previous dialog. The selected fields will be converted to currency format.

Click to view larger image

Numeric Data in Currency Format

Next, select the Discontinued column. The border outline will appear by clicking it. Again, click the Data Format button . This time a dialog will appear allowing you to select a format for the Boolean column. Select Yes/No and click OK. The data in the column will now change.

Data Format Dialog for Boolean Data

Now we will edit the label text. By default column headers will display the column names from the database. However, you can override these headers with a custom one. Double click on the ProductID cell and a dialog will appear allowing you to modify the column header. Insert a space between Product and ID and click OK. The change will appear in the design window.

Edit Column Header Dialog

Repeat this for each column label except Discontinued so that you have inserted appropriate spaces in all of them.

Q.4.2.4. Set Dual Colors

The dual colors feature in EspressReport allows users to differentiate different rows or groups of data by changing the background color, and/or font. Use the group selection tool to turn on dual colors and select all of the columns in the report (not headers).

Next, select the Dual Colors button on the toolbar . A dialog will appear prompting you to set dual colors for the columns. Click the checkbox labeled Enable Dual Colors. Then select the Row Index radio button to indicate that you would like to change color based on a row value. Enter 1 for the row index value.

Dual Colors Dialog

Next, click the Background Color button. A dialog will appear giving you the option to set the background transparent and showing the current background color.

Background Transparency Dialog

Click the button labeled Click and a new dialog will appear with color swatches allowing you to select a new background color.

Choose Color Dialog

Select the new background color that you would like to use and click OK. You will return to the first dialog where the color selection will be reflected. Click the OK button again and you will return to the Dual Colors dialog. Once you are back at the Dual Colors dialog, click the Font Style and Size button. This will bring up a dialog allowing you to specify the font, font size, and font style for the alternating rows.

Font Style and Size Dialog

From this dialog, set the Name to Dialog, the Style to Plain and the Size to 9. This will match the fonts for the alternating rows. Click OK to go back to the dual colors dialog and once more to return to the Report Designer. Now when you preview the report you will see alternating bands of color for each row.

Click to view larger image

Dual Colors in Preview

Q.4.2.5. Inserting Elements

To further customize reports, many different types of elements can be added to a report template.

Q.4.2.5.1. Insert an Image

To insert an image into the report header, first you will want to resize the section to fit the image. In the design window, place the mouse over the lower section divider of the Report Header section, click and drag down making the section about an inch taller.

Re-Sizing a Report Section

Once the section is resized, click the Image button on the toolbar . A small rectangle will follow your mouse pointer around the design window. Position the rectangle in the upper left-hand corner of the Report Header section and click. A dialog will appear prompting you to select an image to insert. Click on Browse and navigate to help/examples/DataSources/database/Woodview.gif. You should now see an image in the preview panel.

Insert Image Dialog

Click OK and the image will be inserted into the report. The image will be represented by a gray rectangle in the design view. You can see the image when you preview the report.

Q.4.2.5.2. Insert a Title

To insert a title, click the Insert Label button on the toolbar . A small rectangle will now follow your mouse pointer around the design window. Position the rectangle next to the image you are inserted in and click. A dialog will appear prompting you to enter the label text. Type in the text of your desired title.

Insert Label Dialog

Click OK and the title will be added to the report. As you can see, the text is fairly small by default. To change this, change the font size dialog on the toolbar to be 18pt font.

Toolbar Font Options

When you do this you will notice that some of the text in the title cell has now disappeared. This is because the text is now larger than the space defined. To resize the cell, right click and drag until you can see the report title again.

Then click the Left Alignment button on the toolbar to set the text alignment to the left as you did for the other report elements. Move and position the title cell so it is next to the inserted image.

Click to view larger image

Report Header with Image and Title

Q.4.2.5.3. Insert a Line

Next, we will add a horizontal line below the column headers. To do this, first resize the Table Header section slightly to provide some more space below the column headers. Next, select the Insert Horizontal Line button on the toolbar . Your cursor will then change into a cross. Click below the ProductID header and drag across to the last column to draw the line.

Click to view larger image

Drawing a Line in Report Designer

Q.4.2.6. View Report Elements in Report Explorer

Report Explorer from the Option menu is turned on by default. It is the panel on the left-hand side of the Report Designer, showing the report elements in a tree format. Click to expand some of the sections and you will see all of the elements in the report represented in the tree. If you select one of the elements in the tree, the corresponding element in the report will be selected.

Click to view larger image

Designer with Explorer Open

You can close the report explorer by selecting Report Explorer again from the Option menu.

Q.4.2.7. Set Section Options

In EspressReport, each of the report sections has a number of configurable options allowing you to display the data in the sections in any number of different ways. To invoke the options menu for a section, click the button for that section on the left-hand side of the design window. In this example, bring up the options menu for the Table Header section by clicking on the corresponding button.

From the pop-up menu select Repeat On Every Page. This will cause the Table Header to be drawn on each report page instead of only once (which is the default). For more about report section options, see Section 4.1.3.3 - Section Options.

Now that you have finished formatting the report, preview it to see the results.

Click to view larger image

Finished Report

Now save the changes you have made to the report and exit from the Report Designer.

Q.4.3. Advanced Reporting Features

Q.4.3.1. Formulas & Scripting

EspressReport ES provides a large built-in formula and scripting library, giving you many ways to manipulate and analyze report data. In the following section we will take a template and use formulas and scripts to calculate/add some values to the report.

Following the same procedure as in Section Q.4.2.1 - Add a Report Template to Organizer, add the QuickStart53.rpt file under help/quickstart/templates into your project in the Organizer. Then right click on the entry for this file in Organizer and select Open File from the pop-up menu. This will open the report in Report Designer.

Click to view larger image

QuickStart53.rpt in Report Designer

The report is an invoice created using the Master & Details layout. Notice that the Item Total, as well as the Sub-total are blank. We will add in the formulas to calculate these values.

Q.4.3.2. Add a Formula

To insert a formula, click the Insert Formula button on the toolbar . This will bring up a dialog containing all the formulas within the report. Notice that the template has several existing formulas. Click New to create a new formula. At the prompt, specify the name ItemTotal for the formula.

Report Formula List

The Formula Builder window will then open. Double click on the Columns folder in the right-hand side to expand it. Then double click on the UnitPrice column to add it to the formula. Next, click the multiply ("*") button. Next, double click on the Quantity column to add it. The finished formula should look like this: {UnitPrice}*{Quantity}.

Click to view larger image

Formula Builder Window

Click the Test button to ensure that the formula is entered correctly. Then click OK. You will be taken back to the formula list where your new formula has been added. From the formula list, select the ItemTotal formula that you just created and click the Insert button. The dialog will close and a small dotted rectangle will follow your pointer around the design window. Position the formula below the Item Total label and between the lines in the Table Data section and click. The formula will then be added to the report.

Next set the data format for the formula to be currency, like in Section Q.4.2.3 - Data Formatting.

Click to view larger image

Formula is Inserted

Now preview the report, notice that because the formula was added to the Table data section, it now computes for each row of data.

Click to view larger image

Report with Formula

Q.4.3.3. Add a Script

Notice that the formula you added in the previous section does not correctly calculate the line total for the invoice. By only multiplying the unit price and the quantity the formula is ignoring whether an item was stained (which incurs an additional cost). To take care of this, we will use cell scripting.

To add a script, select the ItemTotal formula that you created in Section Q.4.3.2 - Add a Formula and click the Scripting button on the toolbar . This will bring up a dialog containing all the scripts in the report. Since no scripts have been previously added the dialog will be blank.

Click to view larger image

Script List Window

Click New to create a new script. In the prompt, type the name StainCheck for the script. Click OK and the Formula Builder will open allowing you to add the script. Enter the following script:

if ({Stain} == True) {

value=({UnitPrice}+{StainPrice})*{Quantity};

} else {

value={UnitPrice}*{Quantity}; }

		

The script dynamically modifies the ItemTotal price depending on whether the item has been stained or not. If the item has been stained({Stain} == True) then the ItemTotal value includes the stain price. If the item has not been stained, the price is calculated in the same manner as before.

Click to view larger image

Formula Builder for Cell Scripts

Click Test to ensure that the script has been entered correctly. Then click Ok. You will return to the script list where the new script has been added. In the script list, select the script that you just created and click the Apply button to apply the script to the column. Notice that a check mark appears in the upper-left hand corner of the cell to which the script has been applied. Then click the Close button to close the dialog.

Cell with Applied Script in Design Window

Q.4.3.3.1. Add an Aggregation

In ERES, formulas can also be used to aggregate report columns. Adding an aggregation is the same as adding a formula like in Section Q.4.3.2 - Add a Formula. Click on the Insert Formula icon and then click on the New icon to create a new formula. Name this formula SubTotal.

In the Formula Builder, double click on the Numeric Functions folder to expand it. Double click on the sum(field) function to insert it into the formula. Next use the cursor to highlight the field portion of the sum function. Double click on the Columns folder to expand it. At the end of the list of columns is one called ItemTotal that you created in Section Q.4.3.2 - Add a Formula. Double click it to add it to the formula. The finished formula should look like this: sum({ItemTotal})

Click to view larger image

Formula Builder with Aggregation Formula

Click Test to ensure that the formula is entered correctly. Then click OK to return to the formula list. In the formula list, select the formula that you have created and click the Insert button. The dialog will close and a small dotted rectangle will follow your pointer around the design window. Position the formula in the Group Footer section of the report, below the Item Total column, and click to add it.

Click to view larger image

Formula Added

Because the formula is in the Group Footer section, it will not calculate until the report is run, and it only displays the text of the formula. Format the formula as currency like in Section Q.4.2.3 - Data Formatting. Now preview the report. Notice that the aggregation reflects the values that are modified by the cell script.

Click to view larger image

Report With Formulas

For additional tutorial, add two more formulas to the Group Footer section: one to calculate the sales tax and one to calculate a grand total for the order. Once you have finished, click the Save button to save the changes that you have made and close the Report Designer.

Q.4.3.4. Drill-Down

A unique feature of ERES is the ability to perform drill-down on reports automatically. Using drill-down, users can easily present summarized data in a top-layer report and can click through to view more detailed information. Using this feature, only one template has to be designed for each level of drill-down. For more information on this feature, see Section 4.1.8 - Drill-Down.

Because the drill-down features uses parameterized queries, you will have to have the Woodview database set up (detailed in Section Q.3.1.1.1 - Setup a JDBC Connection) in order to do this tutorial.

Following the same procedure as in Section Q.4.2.1 - Add a Report Template to Organizer, add the QuickStart532.rpt file under help/quickstart/templates into your project in the Organizer. Right click on the entry for this file in Organizer and select Open File from the pop-up menu. This will open the report in Report Designer.

Click to view larger image

QuickStart532.rpt in the Design Window

The report shows aggregated sales data grouped by product category. Next, we will link this template to another parameterized template, so that users can drill into each category and look at the sales figures for products in each category. To add a layer of drill-down, select Navigate from the Drill-Down menu in the navbar. This will bring up a dialog showing the hierarchy of the any drill-down layers for the report. Only the root will show because there are not any layers defined.

Drill-Down Navigation Dialog

To add a new layer of drill-down, click the ADD button. This will bring up a dialog asking you if you would like to use an existing template or create a new one. If you select to create a new template, you will go back to the data registry where you can start designing a report. You can also use an existing report. In either case, the report you use must have a parameterized query or class as the data source. For more on this see Section 3.1.3.2.2 - Parameterized Queries and Section 3.1.6.1 - Parameterized Class Files. In this instance, select to use an existing report and click Next.

Report Options Dialog

At the prompt browse to the <ERESInstallDir>/help/quickstart/templates, and select the QuickStart532a.rpt file (or QuickStart532a_Acc.rpt from the /Access/ directory). A dialog will then open prompting you to select a column from the primary report to map to the drill-down layer.

Column - Parameter Mapping Dialog

Select to map the CategoryName column to the parameter, and click OK. A dialog will open prompting you to specify a display name for the report. Enter a name and click OK. The drill-down layer will now open in the design window.

Click to view larger image

First Drill-Down Level in Report Designer

If you preview this level, you can see how the report is parameterized based on the Category Name. Back in the design window, again select Navigate from the Drill-Down menu. You will now see a new node for your added level under the ROOT node. The stars "**" indicate which level is currently open in the designer.

Drill-Down Navigation Dialog with Additional Layer

Now we will add one more layer of drill-down to this report, that allows users to drill through the product sales, to see the records of each order for a given product. To do this, select the node for the level you created, and click Add.

Again, select to use an existing template for the new drill-down layer. At the dialog, browse to the <ERESInstallDir>/help/quickstart/templates directory and select the QuickStart532b.rpt file (or QuickStart532b_Acc.rpt from the /Access/ directory). This will bring up the parameter to column mapping dialog.

Second Parameter Mapping Dialog

Select to map the Product Name column to the parameter and click OK Enter a display name for the new layer and click OK again to open it in the design window.

Click to view larger image

Second Drill-Down Level in Report Designer

Now, select Navigate from the Drill-Down menu again. Notice that there is a new node for the layer you just added. Select the root report, and click the Edit button to open it in the design window. You will see the first report open in the designer. Then click Close to dismiss the navigation dialog.

Now preview the report. Notice that the cursor changes when you mouse over a field in the Category Name column. Click on one and you will be taken to the next level that shows sales for each product in that category.

Within the product report you can click on a field in the Product Name column to go to the third level report showing the orders for that particular product.

Click to view larger image
Click to view larger image
Click to view larger image

Drill-Down Reports in Preview Window

To navigate back to higher layers, right click and select Back from the pop-up menu. Now click the Save button to save the changes that you have made to the report.

Q.4.3.5. Sub-Reports

Another powerful feature in ERES is the ability to use sub-reports to create more complex report layouts and combine data from multiple sources in a report. For detailed information about sub-reports, seeSection 4.1.9 - Sub-Reports.

Following the same procedure as in Section Q.4.2.1 - Add a Report Template to Organizer, add the QuickStart533.rpt file under help/quickstart/templates into your project in the Organizer. Then right click on the entry for this file in Organizer and select Open File from the pop-up menu. This will open the report in Report Designer.

Click to view larger image

QuickStart533.rpt in Report Designer

The report uses two levels of nested grouping to show sales for each employee. We will now add a sub-report to the header that shows aggregated sales by category and employee (in a crosstab layout). Before adding the sub-report, we will create a new report section in which to place the sub-report. Although a sub-report can be placed anywhere in a report, it often makes sense to give a sub-report its own section, especially if the size of the sub-report can vary.

To insert a nested section, click the Table Header button on the left-hand side to bring up the section options menu. Select Insert Section. This will spawn a nested section for the table header. For more about nested sections, see Section 4.1.3.1.1 - Nested Sections.

Next we will move the title into the new nested section. To do this, select the cell containing the report title and hit CTRL+X to cut it. Place the cursor in the new section and hit CTRL+V to paste. The cursor will turn to a cross. Position it where you would like the field and click to add it. You may want to resize the new section to fit the cell.

Click to view larger image

New Report Section

Next, click the Insert Sub-Report button on the toolbar . Your mouse pointer will change to the shape of the plus sign. Press the left mouse button in the top-left corner of the Table Header section to insert the SubReport.

As with drill-down, you have the option of creating a new report for the sub-report or using an existing template. Unlike drill-down, however, the template does not have to have a parameterized query as the data source (unless you want to create linked sub-reports. For more on this, please see Section 4.1.9.4 - Linked Sub-Reports). Select to use an existing template and click Next.

Report Options Dialog

At the prompt, browse to the /QuickStart/, select the QuickStart533a.rpt file, and click OK. The sub-report will then open in a new tab called Sub-Report_1 in the Report Designer.

Click to view larger image

Sub-Report in Designer

You can preview just the sub-report by toggling between the Preview and Sub-Report tab. Now go back to the main report by clicking the Design tab. The sub-report will appear as a small gray rectangle. Move the rectangle to the upper left-hand corner of the section and click and drag on the horizontal ruler to increase the width of the sub report to be about seven inches.

Next, we will set the sub-report to resize dynamically. Right click on the sub-report and select Resize To Fit Content from the pop-up menu. This will turn the dynamic sizing on or off.

Now preview the report. You can see that the entire sub-report runs before the main report.

Click to view larger image

Sub-Report with Main Report in Preview

Click to view larger image

Sub-Report with Main Report in Preview

Once you have finished modifying the report, click the Save button on the toolbar to save the changes you have made, and close the Report Designer.