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.
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.
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
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.The bottom of the screen contains two buttons,
and , which allow you to use the query to design a chart or report. To continue designing the report, click . This will bring up a dialog asking you which report layout option you would like to use.From this dialog, select Simple Columnar as the layout and click the 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).
In this dialog, select the following fields for the report:
ORDERID CATEGORYNAME PRODUCTNAME QUANTITY SALES
Once you have selected the fields, click
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.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 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.
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.
Select the Live Data option and click . A parameter selection dialog will appear prompting you to select a start and end date by which to filter the report.
Specify a range that is large enough to produce enough records and click
. 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.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 . This will return you to the Report Wizard, where we will select a different report layout. From the last data mapping dialog, hit the button twice until you get back to the Select Report Format window.
Icon on the toolbarChange the report layout type to Summary Break and click . In the next screen, keep the column selection the same and click 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.
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 button. You will get a warning if you have not applied template. Click to continue. You will be taken back to the Report Designer where the new mapping has taken effect.
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.
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 button until you get back to the layout selection screen. From this screen, select to use a CrossTab layout and click . At the column selection/ordering screen (next in the Wizard), change the selection to be the following:
CATEGORYNAME REGION SALES
Once you have specified the columns in the correct order, click the
button to bring up the data mapping option for the 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
button to go to the Report Designer. You will get a warning if no template was applied. Click to continue.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).
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 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
Once you have specified the columns in the correct order, click the
button to bring up the data mapping dialog for the master & details layout.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
to get to the Report Designer from this screen, click the button to invoke the additional pre-formatting options. You will get warning that all the formating will be lost. Click to continue to the dialog that allows you to add several elements to the report.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 . A new dialog will open allowing you to specify a style for the new report.
Select the Block Left-Align style and click the 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.
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.
Now that you have finished creating a report, click the . This will bring up a new dialog, allowing you to specify save options for the report.
button on the toolbar to save the reportEnter a name for the report and click /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.
Click
and the report will be added to your project in the Organizer.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 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
. The query result show up:click the Mailing Labels layout. The next screen is to select columns to the report, click :
button and select theOnce you have specified the columns in the correct order, click the
button to bring up the data mapping dialog for the maling labels layout.Click the
, You will be taken to the Report Designer.We don't need the left columns in Mailing Label Report. We select all the left columns:
And remove them. We continue to edit the report to get general mailing label appearance:
Now click on the Preview tab to preview the Mailing Labels layout.
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 in the prompt and specify the name for the new-created Mailing Label Report.
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.
If you do not have the Organizer open, open it. Then select your project in the left-hand side. Next, click the . A new dialog allowing you to select a file to insert into the Organizer.
button on the toolbarIn the dialog, click the 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 to add the report. The dialog will close and you will see an entry in the Organizer for the newly added report.
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.
Once the fields in the report have been selected, click and drag to indent them about half an inch. Next, click the . This will align all of the cell text to the left edge of the cell.
button on the toolbarThere 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).
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 .
This will open a new dialog. From this dialog select Fixed Point and click the button. At the next dialog select to have two decimal points and select the dollar sign as the Units symbol.
Click
and again at the previous dialog. The selected fields will be converted to currency format.Next, select the Discontinued
column. The border outline will appear by clicking it. Again, click the button . This time a dialog will appear allowing you to select a format for the Boolean column. Select Yes/No and click . The data in the column will now change.
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 . The change will appear in the design window.
Repeat this for each column label except Discontinued
so that you have inserted appropriate spaces in all of them.
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 . 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.
Next, click the
button. A dialog will appear giving you the option to set the background transparent and showing the current background color.Click the button labeled
and a new dialog will appear with color swatches allowing you to select a new background color.Select the new background color that you would like to use and click
. You will return to the first dialog where the color selection will be reflected. Click the button again and you will return to the Dual Colors dialog. Once you are back at the Dual Colors dialog, click the button. This will bring up a dialog allowing you to specify the font, font size, and font style for the alternating rows.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 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.
To further customize reports, many different types of elements can be added to a report template.
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.
Once the section is resized, click the . 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 and navigate to help/examples/DataSources/database/Woodview.gif
. You should now see an image in the preview panel.
Click
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.To insert a title, click the . 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.
button on the toolbarClick
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.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
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.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 . Your cursor will then change into a cross. Click below the ProductID
header and drag across to the last column to draw the line.
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.
You can close the report explorer by selecting Report Explorer again from the Option menu.
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.
Now save the changes you have made to the report and exit from the Report Designer.
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.
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.
To insert a formula, click the . This will bring up a dialog containing all the formulas within the report. Notice that the template has several existing formulas. Click to create a new formula. At the prompt, specify the name ItemTotal
for the formula.
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 button. Next, double click on the Quantity column to add it. The finished formula should look like this: {UnitPrice}*{Quantity}
.
Click the ItemTotal formula that you just created and click the 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.
button to ensure that the formula is entered correctly. Then click . You will be taken back to the formula list where your new formula has been added. From the formula list, select theNext set the data format for the formula to be currency, like in Section Q.4.2.3 - Data Formatting.
Now preview the report, notice that because the formula was added to the Table data section, it now computes for each row of data.
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 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 StainCheck
for the script. Click 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 ensure that the script has been entered correctly. Then click . 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 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 button to close the dialog.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 icon and then click on the 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 Group Footer section of the report, below the Item Total
column, and click to add it.
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.
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 button to save the changes that you have made and close the Report Designer.
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.
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.
To add a new layer of drill-down, click the 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 .
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 seeAt 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.
Select to map the CategoryName
column to the parameter, and click . A dialog will open prompting you to specify a display name for the report. Enter a name and click . The drill-down layer will now open in the design window.
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.
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
.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.
Select to map the Product Name
column to the parameter and click Enter a display name for the new layer and click again to open it in the design window.
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.
To navigate back to higher layers, right click and select Back from the pop-up menu. Now click the button to save the changes that you have made to the report.
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.
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 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.
button on the left-hand side to bring up the section options menu. SelectNext 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.
Next, click the . 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 .
At the prompt, browse to the /QuickStart/
, select the QuickStart533a.rpt
file, and click . The sub-report will then open in a new tab called Sub-Report_1
in the Report 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.
Once you have finished modifying the report, click the
button on the toolbar to save the changes you have made, and close the Report Designer.