Creating a Table

To create a table in a report, drag the Table element from the Elements palette inside any band of the report. The Table Wizard opens with a choice of creating a table from a new or existing dataset.

Table Wizard - New Table

If you choose to create an empty table, a new dataset is created and bound to the table. If you don't have an existing dataset, that option is disabled and Create a Table using a new dataset is selected.

To create a table from a new dataset:

1. From Table Wizard - New Table click Next.

The Dataset window appears.

Table Wizard - Dataset

2. Name your dataset and select whether to create the dataset from a connection or data source or to create an empty dataset. For this example, select Create new dataset from a connection or datasource. Click Next.

The Dataset > Datasource window appears.

Table Wizard Dataset > Datasource

3. Select a data source and enter an SQL query such as: select * from orders. Click Next.

The Dataset > Fields window appears.

Table Wizard Dataset > Fields

4. Using the arrow buttons, select the fields you want in your table. Click Next.

The Dataset > Group By window appears.

Table Wizard Dataset > Group By

5. Select a field or fields to group by. Click Next.

The Table Wizard > Connection window appears.

Table Wizard > Connection

6. In this window you have the choice to use the same connection as the master report, another connection, an empty data source, a JRDatasrouce expression or no connection or data source.

In most cases, choose Use the same connection used to fill the master report.

Choose empty data source if you want to create a table without relying on external data.

Choose Don’t use any connection or datasource in the unusual case that the dataset uses a special query executer that does not need a source to produce data.

Click Next. The Table Wizard > Table Columns window appears.

Table Wizard > Table Columns

7. Using the arrow buttons, select the fields you want to use as table columns. Click Next.

The Table Wizard > Layout window appears.

Table Wizard > Layout

8. Select the layout for your table, and click Finish.

The table appears in your report, in the spot where you dragged the element.

Report Containing a Table

To create a table using an existing dataset:

Creating a table using an existing dataset is largely the same as creating a table using a new dataset.

1. In the Table Wizard > Dataset window, select Create a Table using an existing dataset.
2. Select a dataset from the drop-down.

Table Wizard > Dataset

3. Click Next. The Table Wizard > Connection window appears.

Table Wizard > Connection

From this point the steps are the same as creating a table using a new dataset.

Version: 
Feedback
randomness