Inserting Tables in a Report
With the table wizard, it is easy to create tables in a report, however the wizard varies with the data resource type used for the table: business view or query resource. This topic introduces how to insert tables into different report types using different data sources.
A web report and library component can only use business views. For a page report it 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.
A table can be inserted in the report areas listed in Component Placement. When a table is inserted into a banded object in a page report, you can use a data container link to define the relationship between the table and its parent.
This topic shows creating tables using different data resources in detail:
Creating a Table Based on a Business View
- 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.
- Select 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.
- Table (Group Above)
The Create Table wizard appears, which contains a set of screens for helping you define a table easily. You can use the Back and Next buttons or select the screen name on the screen navigation bar to switch between the screens. When creating a table in a web report or library component, you will get different screens according to the selected table type: group table or summary table.
- In the Data screen, select the business view in the current catalog using which to create the table. When the table is to be inserted into the banded header, banded footer, group header, group footer panel of a banded object in a web report, you can also check Inherit from the Parent to inherit data from the business view used by the parent banded object.
- Specify the data to display in the table.
To define the data for a group table in a web report/library component, or for a table in a page report:
- In the Display screen, specify a title for the table in the Title text box if needed, then add the detail fields you want to display in the table.
The Resources box lists the data objects that can be used as detail fields in a table. These objects include: group objects and detail objects in the specified business view, dynamic formulas used as Group and dynamic formulas used as Detail created for the business view in the current report.
To add a detail field, select an object in the Resources box, then select or drag and drop it to the right box; to remove an unwanted detail field, select it and select or drag and drop it to the Resources box. To adjust the display order of the detail fields in the table, make use of and . By default the display names of the added objects will be used to label the corresponding detail columns; to edit the label text for a detail column, select in the Display Name text box and enter a new one; if you want to automatically map the label text to the dynamic display name of the field at runtime, check the Auto Map Field Name checkbox in the text box. If needed, select the Sort Fields By button to specify in which manner to sort the detail values.
- In the Group screen, specify the criteria for grouping data in the table.
- In the Summary screen, add summaries to calculate data in the table.
The Resources box lists the aggregation objects in the specified business view, as well as the dynamic formulas used as Aggregation and dynamic aggregations created for the business view in the current report. You can add them as summaries to calculate data in the table.
To add a summary in the table, in the right box select the group to which the summary will be applied (if you select Table, it will be based on the whole business view), select an object in the Resources box and select or drag and drop it to the right box. You can add several summaries for any group level; to adjust the display order of the summaries in a group or move a summary to another group, make use of or . The Position and Column options work together to determine the positions of the summaries in the table.
- If the table is of the Group Above type, a summary added for the Table level is placed in the intersection of the table footer panel and the first two detail columns with its name label which is the display name of the field used for the summary by default; a summary added for a specific group is placed in the intersection of the group's footer panel and the first two detail columns with its name label.
- If the table is of the other types, you can customize the position of the summaries. When a summary is added for the Table level, you can place it and its name label in the intersection of the table footer panel (Footer)/table header panel (Header) and the first two detail columns (Detail)/a new summary column (Summary); for a summary added to a specific group, you can place it and its name label in the intersection of the group footer panel/group header panel and the first two detail columns/a new summary column.
To define the data for a summary table in a web report/library component:
- In the Columns screen, specify the columns you want to display in the table.
The Resources box lists the group objects and aggregation objects in the specified business view, as well as the dynamic formulas used as Group , dynamic formulas used as Aggregation and dynamic aggregations created for the business view in the current report. You can create columns in the table from these objects.
To add a column, select an object in the Resources box and select or drag and drop it to the right box; to remove an unwanted column, select it and select or drag and drop it to the Resources box. Select or to adjust the display order of the columns. 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 any group level, you can customize its sort manner and define Select N condition to show data of certain range in its groups.
- In the Summary screen, 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 the corresponding summary column and the table/group header/footer panel.
- In the Display screen, specify a title for the table in the Title text box if needed, then add the detail fields you want to display in the table.
- In the Filter screen, apply a filter to reduce the data displayed in the table. You can select a predefined filter of the specified business view from the Filter drop-down list to apply, or select User Defined in the list to define a new filter as required.
- In the Style screen, specify the 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.
- Select Finish to insert the table.
If you have used the menu tab command to insert the table and selected a panel in a banded object as the table destination, after selecting Finish in the wizard, you need to select the mouse button in the destination once again in order to insert the table there.
Creating a Table Based on a Query Resource
- Position the mouse pointer at the destination where you want to insert the table.
- Do either of the following:
- Drag the button representing the required table type from the Grid category of the Components panel to the destination.
- Select Insert > Table or Home > Insert > Table, then in the Table Type dialog choose a type for the table.
The Create Table wizard appears, which contains a set of screens for helping you define a table easily. You can use the Back and Next buttons or select the screen name on the screen navigation bar to switch between the screens.
- In the Data screen, select the data resource using which to create the table.
If the predefined data resources are not what you want, you can select the first item in the corresponding resource node to create one. When a query is selected, select 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, select the More Options button and then:
- Check the Existing Dataset radio button and select a dataset. You can select the Edit button to modify the selected dataset in the Dataset Editor if necessary, or select 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, Logi 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 data fields you want to display as detail fields in the table.
The Resources box lists all the DBFields in the specified data resource, as well as the formulas and parameters that are valid to these DBFields in the current catalog. You can use them as detail fields in the table.
To add a detail field, select an object in the Resources box and select or drag and drop it from the Resources box to the right box; to remove an unwanted detail field, select it and select or drag and drop it to the Resources box. You can make use of and to adjust the display order of the detail fields in the table. By default the display names of the added objects will be used to label the corresponding detail columns; to edit the label for a detail column, select in the Display Name text box and enter a new name. If needed, select the Sort Fields By button to specify in which manner to sort the detail values.
Tip: If you are creating a summary table, the detail columns for the added detail fields will not be shown after the table is generated by default. If you want to show the detail columns in a summary table, when the table is created:
- Select the table, right-click it and select Show Column on the shortcut menu.
- In the Show Column dialog, select the column names for the detail columns you want to show and select OK.
- Go to the Report Inspector, select the Table Detail node of the table, set the Invisible property to false.
- In the Group screen, specify the criteria for grouping data in the table.
- In the Summary screen, add summaries to calculate data in the table.
The Resources box lists all the DBFields in the specified data resource, as well as the formulas that are valid to these DBFields in the current catalog. You can create summaries based on these objects in the table.
To add a summary, in the right box, select the group to which the summary will be applied (if you select Table, it will be based on the whole dataset), select an object in the Resources box and select or drag and drop it to the right box, then specify the aggregate function as required. When DistinctSum is selected as the function, you should select in the Distinct On text box to specify one or more fields according to whose unique values to calculate DistinctSum using the Select Fields dialog. You can add several summaries for any group level. When the table is created, Logi 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 select or drag and drop it to the Resources box. You can make use of and to adjust the display order of the summaries in the current group or move a summary to another group. The Position and Column options work together to determine the positions of the summaries in the table.
- If the table is of the Group Above type, a summary added for the Table level is placed in the intersection of the table footer panel and the first two detail columns with its name label which is the display name of the field used for the summary; a summary added for a specific group is placed in the intersection of the group's footer panel and the first two detail columns with its name label.
- If the table is of the other types, you can customize the position of the summaries. When a summary is added for the Table level, you can place it and its name label in the intersection of the table footer panel (Footer)/table header panel (Header) and the first two detail columns (Detail)/a new summary column (Summary); for a summary added to a specific group, you can place it and its name label in the intersection of the group footer panel/group header panel and the first two detail columns/a new summary column.
The summaries created from the Summary screen will be added to the current catalog 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.
- In the Filter screen, add filter conditions on the fields that have been added to the table to reduce the data. Select here for how to define a filter.
- In the Style screen, specify the layout and style of the table.
In the Grow Report box, select whether to place the table vertically or horizontally. In the Style box select the 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.
- Select Finish to insert the table.
If you have used the menu tab command to insert the table and selected a panel in a banded object as the table destination, after finishing the wizard, you need to select 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.