Previous Page Next Page
Inserting a Table
Inserting a table into a web report or library component
Inserting a table into a page report
With the table wizard, it is easy to create tables in a report, however, the wizard varies slightly with different report types: web report/library component, and page report.
A table can be inserted in the report areas listed in Component placement.
Inserting a table into a web report or library component
- Position the mouse pointer at the destination where you want to insert the table.
- Do either of the following:
- Drag the required table type button from the Grid category of the Components panel to the destination.
- Click Insert > Table or Home > Insert > Table, then in the Table Type dialog choose a type for the table.
The Create Table wizard appears.
- In the Data screen, select a business view in the current catalog on which to create the table.
- Specify the data displayed in the table. Depending on the table type selected in step 2, the screens for defining the data vary:
To define the data for a group left, group above, or group left above table:
- In the Display screen, specify a title for the table in the Title text box if needed, then add group objects, detail objects or dynamic formulas used as Group or Detail to the table as detail fields. To add a detail field, select an object in the Resources box, then click
or drag and drop it to the display field box on the right. If a field is not required, select it and click
or drag and drop it to the Resources box. Click
or
to adjust the order of the fields. If required, modify the display name of any added field by clicking its Display Name text box. You can also click the Sort Fields By button to specify how to sort data in the table.

- In the Group screen, add the group objects or dynamic formulas used as Group as the grouping criteria.
- In the Summary screen, add aggregation objects, dynamic formulas used as Aggregation or dynamic aggregations to summarize data in the table as follows: in the sum on box on the right, specify the group to which the aggregation will be applied (if you select Table, it will be based on the whole business view), select an object in the Resources box and click
or drag and drop it to the right box, then specify where to place the aggregation in the table from the Position and Column columns. You can add several aggregations for any group level. If an aggregation is not required, select it and click
or drag and drop it to the Resources box. Click
or
to adjust the order of the aggregations in the current group or move an aggregation to another group if needed.
The Position and Column columns work together to show the positions of the aggregations. When an aggregation is added right below the Table node, the aggregation and its label will be placed in the intersection of the table footer
panel and the first two detail columns.
When an
aggregation is added below a specific group node, the aggregation and its label will be placed in the intersection of the group footer panel and the first two detail columns.

To define the data for a summary table:
- In the Columns screen, specify the columns you want to display in the table. Only aggregation objects, group objects and dynamic resources (including dynamic formulas used as Aggregation or Group and dynamic aggregations) can be added to the table. To add a column, select an object in the Resources box and click
or drag and drop it to the column box on the right. You can add only one object at a time. If an object is not required, select it and click
or drag and drop it to the Resources box. Click
or
to adjust the display order of the objects. The table will be automatically grouped by the added group objects and the position of the group objects in the right box determines the group level: the topmost group object the highest group level and the lowest group object the innermost group level. All the aggregation objects are parallel and calculate based on the innermost group. For a group, you can specify its sorting manner and define the Select N condition to show data of certain range in the group.

- In the Summary screen, you can insert the aggregation objects selected in the Columns screen to the table header/footer and to the group headers/footers of existing groups as summaries. First select an aggregation object in the Resources box, then select the checkboxes representing the required locations. The summary will be placed in the intersection of its summary column and the table/group header/footer panel.

- In the Filter screen, define filter conditions to filter the data displayed in the table.
- In the Style screen, specify the style of the table.
- Click Finish to insert the table.
If you have used the menu tab command to insert the table and specified to insert it to position other than the report body or tabular cell, after clicking Finish in the wizard, you need to click the mouse button in the destination once again in order to insert the table there.
Inserting a table into a page report
A page report can be created either based on query resources or business views, which is determined at the time when the page report is created by the Create Using Business View option. Once defined, all the data components in the page report can only be created on the specified data resource type. The procedure for creating a table in a page report varies with the data resource type specified for the page report: query resource or business view.
To insert a table in a page report that is based on query resources:
- Position the mouse pointer at the destination where you want to insert the table. It can be in an empty area of the page report or inside a banded object.
- Do either of the following:
- Drag the required table type button from the Grid category of the Components panel to the destination.
- Click Insert > Table or Home > Insert > Table, then in the Table Type dialog choose a type for the table.

- Table (Group Above)
Creates a table with group information above the detail row.
- Table (Group Left)
Creates a table with group information left to the detail row.
- Table (Group Left Above)
Creates a table with group information left and above the detail row.
- Summary Table
Creates a table with only group and summary information.
The Create Table wizard appears.
- In the Data screen, select the data resource on which to create the table. If the given data resources are not what you want, click the first item in the corresponding resource node to create one. When a query is selected, click the Edit button to modify the query if required. Then a new dataset based on the selected data resource is created in the page report.
If you want to use an existing dataset in the current page report to create the table, click the More Options button and then:
- Check the Existing Dataset radio button and select a dataset. You can click the Edit button to modify the selected dataset in the Dataset Editor if necessary, or click the <New Dataset...> item to create a new dataset in the page report to use. It is always better to use an existing dataset rather than create a new one. Even when the two datasets are based on the same query, JReport will still run the query separately for each dataset.
- Check the Current Dataset radio button to make the table inherit the dataset from its parent.

- In the Display screen, add the fields to be displayed as detail fields in the table. To add a field, select it in the Resources box and click
or drag and drop it from the Resources box to the display field box on the right. If a field is not required, select it and click
or drag and drop it to the Resources box. Click
or
to adjust the order of the fields. If required, modify the display name of any added field by clicking its Display Name text box. You can also click the Sort Fields By button to specify how to sort data in the table.

- In the Group screen, add the fields as the grouping criteria.

- In the Summary screen, add fields as summary fields to summarize data in the table as follows: in the sum on box on the right, specify the group to which the summary will be applied (if you select Table, it will be based on the whole dataset), select a field in the Resources box and click
or drag and drop it to the right box, then specify the aggregate function as required. You can add several summaries for any group level. JReport will automatically give the summaries proper name labels to help you clarify the meaning of the numbers. If a summary is not required, select it and click
or drag and drop it to the Resources box. Click
or
to adjust the order of the summaries in the current group or move a summary to another group if needed.
The Position and Column columns work together to decide the positions of the summaries and they are editable for a summary table. When a summary is added right below the Table node, specify whether to place it in the table footer or header panel from the Position drop-down list and whether to place it in the detail column or a new summary column from the Column drop-down list.
The summaries created from the Summary screen will be added to the current catalog data source as static summaries even when identical summaries already exist. Therefore, it is better not to create summaries here, instead you can add dynamic summaries to the catalog and drag and drop the dynamic summaries into the table after it is created.

- To apply filters to the table so as to reduce the data displayed in the table, go to the Filter screen and define the filter conditions.

- In the Style screen, specify the layout and style of the table.

When you have specified to insert the table into a banded object, by default the table will inherit its parent's style. If you want to apply another style to the table, uncheck the Inherit Style option and then select the required style from the Style box. For more information, see Inheriting Styles.
- Click Finish to insert the table.
If you have used the menu tab command to insert the table and specified to insert it to position other than the report body or tabular cell, after clicking Finish in the wizard, you need to click the mouse button in the destination once again in order to insert the table there.
When the table is inserted into a banded object, you can set up data container link between the table and its parent.
To insert a table in a page report that is based on business views:
- Position the mouse pointer at the destination where you want to insert the table. It can be in an empty area of the page report or inside a banded object.
- Do either of the following:
- Drag the required table type button from the Grid category of the Components panel to the destination.
- Click Insert > Table or Home > Insert > Table, then in the Table Type dialog choose a type for the table.
The Create Table wizard appears.
- In the Data screen, select a business view on which to create the table.

- In the Display screen, specify a title for the table in the Title text box if needed, then add the detail or group objects in the specified business view to be displayed as detail fields in the table. To add a detail field, select an object in the Resources box and click
or drag and drop it from the Resources box to the display field box on the right. If a field is not required, select it and click
or drag and drop it to the Resources box. Click
or
to adjust the order of the fields. If required, modify the display name of any added field by clicking its Display Name text box. You can also click the Sort Fields By button to specify how to sort data in the table.

- In the Group screen, add the group objects as the grouping criteria.

- In the Summary screen, add aggregation objects to summarize data in the table as follows: in the sum on box on the right, specify the group to which the aggregation will be applied (if you select Table, the aggregation will be based on the whole business view), select an aggregation in the Resources box and click
or drag and drop it to the right box. You can add several aggregations for any group level. JReport will automatically give the aggregations proper name labels to help you clarify the meaning of the numbers. If an aggregation is not required, select it and click
or drag and drop it to the Resources box. Click
or
to adjust the order of the aggregations in the current group or move an aggregation to another level if needed.
The Position and Column columns work together to decide the positions of the aggregations and they are editable for a summary table. When an aggregation is added right below the Table node, specify whether to place it in the table footer or header panel from the Position drop-down list and whether to place it in the detail column or a new summary column from the Column drop-down list.

- To apply filters to the table so as to reduce the data displayed in the table, go to the Filter screen and define the filter conditions.

- In the Style screen, specify the layout and style of the table.

When you have specified to insert the table into a banded object, by default the table will inherit its parent's style. If you want to apply another style to the table, uncheck the Inherit Style option and then select the required style from the Style box. For more information, see Inheriting Styles.
- Click Finish to insert the table.
If you have used the menu tab command to insert the table and specified to insert it to position other than the report body or tabular cell, after clicking Finish in the wizard, you need to click the mouse button in the destination once again in order to insert the table there.
Notes:
- The content of the table in some pages that cannot be displayed will be cut off if the height of the table is higher than that of the page, however, when exporting the table to an Excel file with column format or data format, or to text with delimited format, or to XML, no content will be cut off.
- When creating a table of the Group Above or Group Left type, by default all the summaries of the same functions will be aligned horizontally in the table. If you want to align them vertically, check the option Align summaries vertically in the Options dialog in advance.
See also:
- An example: The SampleComponents catalog, included with JReport Designer, contains reports that have examples of report component types. For the table component example, open
<install_root>\Demo\Reports\SampleComponents\TableReport.cls
.
Previous Page Next Page