The following sections explain how to populate, edit, and format your table-type view.
Using Fields in Tables
Insert data into your table by adding fields. All available fields are listed in the Data Source Selection panel, on the left side of the Ad Hoc Editor.
The available fields are divided into two sections in the panel:
| • | Fields, which can be added to the table as columns or groups. |
| • | Measures, which are specialized fields that contain data values. |
To add fields and measures as columns to a table:
| 1. | In the Data Source Selection panel, click to select the field or measure you want to add to the table. Use Ctrl-click to select multiple items. |
| 2. | Drag the selected item into the Columns box in the Layout Band. |
The field is added to the view as a column in the table.
To remove a field or measure from a table:
| • | In the Layout Band, click the x next to the field or measure’s name. |
Groups
Groups allow you to create detailed data rows. For example, if you have a table that lists the suppliers for a national restaurant chain, you can group the suppliers by the State field. The suppliers’ names are then rearranged so that all suppliers located in Maine, for instance, are located under a “Maine” header row; suppliers in Maryland are together under a “Maryland” header row, and so on.
You can use multiple fields to make more specific nested groups. By adding a group based on the “City” field to the table described above, the restaurant suppliers are arranged by City within the State groups. Under the “Maine” header row, new header rows for Augusta, Bangor, and Portland are added, and the names of the Maine-based suppliers appear under their respective cities. Under the “Maryland” header row, header rows for Annapolis, Baltimore, and Silver Spring are added, and the names of Maryland-based suppliers appear under those headers, and so on.
Only fields can be applied to a table as a group; measures cannot.
Data is grouped in the table according to the order they have defined. You can change the order by dragging the groups into position if needed.
To create a group:
| 1. | In the Data Source Selection panel, click to select the field you want to add to the table as a group. |
| 2. | Drag the field to the Groups box in the Layout Band. |
The Ad Hoc view refreshes and displays the data grouped under a new header row.
![note-icon-ns_28x28.png.594373df69247293aa0d6b64f44955da.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) | You can also add a group to the table by right-clicking a field and selecting Add as Group. |
To remove a group:
| • | In the Layout Band, click the x next to the field’s name in the Groups box. |
To move a the grouping order up or down in a table:
| • | In the Layout Band, drag the name of the group you want to move into its new position. |
Summaries
You can display summary data for any column in your table. Summary data may be in the form of various functions, such as:
For example, in a table with a list of stores, grouped by City and Country, you can display the number of stores in each City, and in each Country, using this function.
By default, the summary function for each field is defined by the data source, OLAP, or domain definition.
To add a summary to a specific column:
| • | In the table, right-click the column you want to calculate a summary for, and select Add Summary. |
The summary information is added to the group header, or is added to the bottom of a column if no groups are included in the table.
To remove a summary from a specific column:
| • | In the table, right-click the column with the summary you want to remove, and select Remove Summary. |
The summary information is removed from the table.
To add or remove summaries from all columns:
| • | Click ![js-AdHoc-icon-options.png.197b7e3e40b1f4b7669cc0fbafa93620.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
Column and Header Labels
You can edit a column or header label directly in the Ad Hoc Editor.
To edit a column or header label:
| 1. | On the Ad Hoc view panel, right-click the column or group header you want to rename. |
| 2. | Select Edit Label from the context menu. The Edit Label window opens. |
| 3. | In the text entry box, delete the existing name and enter the new name. |
If space is at a premium, you can remove labels from the view. When you delete a label, it still appears when you look at the view in the Ad Hoc Editor, but does not appear when you run the report.
To delete a column or header label:
| 1. | On the Ad Hoc view, right-click the column or header label you want to remove. |
| 2. | Select Delete Label from the context menu. |
To re-apply a label:
| 1. | Right-click the column or header label you want to replace. |
| 2. | Select Add Label from the context menu. The Edit Label window opens. |
| 3. | Enter the label name, if needed. |
Managing Column Size and Spacing
You can change the size of, and spaces between, columns to manage the appearance of your table or use space more efficiently.
To resize a column:
| 1. | In the Ad Hoc View panel, click to select the column you want to resize. |
| 2. | Move the cursor to the right edge of the column. |
| 3. | When the cursor changes to the resize icon (![js-AdHoc-icon-ResizeColumn.png.5d66a5e3d10e71209abaf90ba8152f7f.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
Spacers can be added to a table to arrange columns farther apart, or add margins to a table.
To change the spacing between columns:
| 1. | In the Data Source Selection panel, in the Measures section, click Spacer. |
| 2. | Drag the spacer into the Columns box in the Layout Band between names of the two columns you want to move apart. |
A spacer column, labeled
, appears in the table.
| 3. | Repeat this action to add space as needed between columns. |
| 4. | To remove a spacer, right-click the spacer column and select Remove from Table. |
To use spacers to create table margins:
| 1. | In the Data Source Selection panel, click to select Spacer. |
| 2. | Drag the spacer into the Columns box in the Layout Band. |
| 3. | Repeat until the margins are as wide as needed. |
| 4. | Repeat the steps above, adding the spacer to the right edge of the table. |
Reordering Columns
You can move columns to the right or left to reorder data in your table.
To reorder a column:
| 1. | In the Ad Hoc View panel, right-click the column you want to move. |
| 2. | Select Move Right or Move Left from the context menu. |
Sorting Tables
In the Ad Hoc Editor, you can sort the rows of a table by any field, using a number of different methods.
To sort a table:
| 1. | Click ![js-AdHoc-icon-SortOrder.png.4d013af8386b027eeb1cfb646a4ee954.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 2. | To add a field to sort on, double-click the field in Available Fields. The Available Fields panel now lists only fields not currently in Sort On. |
| 3. | Select one or more fields to sort by. You can also use Ctrl-click to select multiple fields. |
| 4. | Click ![js-AdHoc-icon-Sort-On-Arrow.png.a55e5b4752b406f2d431c18cc361e155.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 5. | To arrange the sorting precedence of the fields, select each field in the Sort window and click Move to top, Move up, Move down, or Move to bottom: ![js-AdHoc-icon-Move-top.png.55ee09122ab2df5cbe3a186fdc7f7183.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 6. | To remove a field, select it and click ![js-AdHoc-icon-RemoveFromSort.png.ae1a53d9c2f2b5435d5057cb933a36d7.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 7. | Click OK. The table updates to display the rows sorted by the selected fields. |
You can also sort a table using the following methods:
| • | Right-click a field in the Fields section of the Data Source Selection panel, and select Use for Sorting from the context menu. In this case, the table is sorted by a field that isn’t in the table; you may want to note the sorting fields in the title. |
| • | Right-click a column header on the Canvas of the Ad Hoc View panel, and select Use for Sorting from the context menu. |
![note-icon-ns_28x28.png.99f33e2e093a7e345856fec698006230.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) | If a column is already being used and you want to stop using it or change the sorting, right-click the column and select Change Sorting from the context menu. |
Adding a Title
| 1. | Above the table, click the text Click to add a title. |
| 2. | Enter the new table title in the text entry box. |
Changing the Data Format
You can change the formatting for columns containing numeric data, such as dates and monetary amounts.
To change the data format for a column:
| 1. | In the Ad Hoc view, right-click the column. |
| 2. | Select Change Data Format from the context menu. |
| 3. | Select the format you want to use. These options vary, depending on the type of numeric data contained in the column. |
The data in the column now appears in the new format.
Changing the Data Source
You may need to select a new data source for your table. This is a simple task, but you should keep in mind that all view data and formatting are lost when you select a new Topic, Domain, or OLAP connection. Any changes to the view are also lost if you navigate to another page using the browser navigation buttons, the main menu, or the Search field. To preserve changes, accept the current Topic or click Cancel.
To change the table’s data source:
| 1. | At the top of the Data Source Selection panel, click ![js-AdHoc-icon-expand-filter.png.d83d5e38868fdd91ce4fb94d2df1841d.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 2. | Select a different Topic, Domain, or OLAP connection. |
| 3. | Click Table to apply the new data source. |
Click Cancel to return to the editor without changing the Topic.
Showing and Hiding Detail Rows
You can simplify or expand the information in your table by hiding or showing detail rows.
To hide detail rows in a table:
| 1. | Place the cursor over ![js-AdHoc-icon-PageOptions.png.ffe1da490222982e0be682b053b95d4d.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 2. | Select Hide Detail Rows to show only the summarized totals for each group. |
The Ad Hoc Editor applies a summary to each field depending on its datatype.
To show detail rows in a table:
| 1. | Place the cursor over ![js-AdHoc-icon-PageOptions.png.f3dda68e21bcec11a52f9e63e1e6f254.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 2. | Select Show Detail Rows to display the detailed information for each group. |
The Ad Hoc Editor displays the complete information in each row.
Controlling the Data Set
You can control the data displayed in the grid using the Grid Detail Selector: ![js-AdHoc-icon-options.png.4a252442d95e83eed42172215ab532b8.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png)
Your options are:
| • | Detailed Data, which displays table detail only. For instance, in a table listing sales in dollars for all stores in a region for a given month, the amount sold by each store that month is displayed. |
| • | Totals Data, which displays the table totals only. In the table described above, the total amount of all sales at all regional stores that month is displayed. |
| • | Details and Totals, which displays both the individual store sales numbers, as well as the total sales numbers at the bottom of the store sales column. |
Click to select the option you want to apply to your table.
Recommended Comments
There are no comments to display.