### Managing tables in an XML connection

A table contains fields mapped to attributes, simple elements, contents of complex elements, and other nodes in XML files. Queries can be built on these tables and a report is developed from a query or something else which is functionally similar.

This document shows how to add more tables to an XML connection, organize the tables, and so on.

#### Adding tables

To add tables which are transformed from an XML file to an XML connection, follow the steps below:

1. Do either of the following:
   - Right-click the XML connection and select Add Tables from the shortcut menu.
   - Right-click the Tables node of the XML connection and select Add Table from the shortcut menu.
   - Right-click any folder in the Tables node of the XML connection if you have already created some and select Add Table from the shortcut menu.
   - Right-click an existing table in the XML connection if there is and select New Table from the shortcut menu.

   The Add Table dialog appears. See the dialog.

2. Click the Load Tables button. The tables contained in the schema that is transformed from the XML file will then be displayed in the Tables box.
3. Choose the required tables in the Tables box, and then click Add.

   To choose consecutive tables, click the first table, press and hold down the SHIFT key, and then click the last table. To choose tables that are not consecutive, press and hold down CTRL, and then click each table.

4. After adding the required tables, click Done to close the dialog.

#### Refreshing tables

The tables in your catalog are a temporary deposit to improve the performance when you design and test your report. Your data source keeps changing over the time. However, these will not be reflected automatically in your catalog. To synchronize your tables in the connection and data source, you can choose to refresh the table information using the Refresh command on the shortcut menu of the table. Then when the refreshing job is done, a reporting dialog will be shown, summarizing the changes and operations that have been taken.

#### Organizing tables

You can organize the tables in an XML connection by arranging them in different folders in the Catalog Browser.

To add a folder:

1. Right-click the Tables node, or any existing folder and select Add Folder from the shortcut menu.
2. A new folder is added to the Tables node, or in the selected folder. Type a name for the folder in the editing area, and then click outside to confirm the change.

To move tables to a folder:

1. Right-click the table you want to move in the Tables node and select Move To from the shortcut menu.
2. In the Move Table dialog, select the folder to which the table will be moved, then click OK.

#### Removing and adding columns to tables

By default, when you add a table, you add all the columns reside in the table. However, JReport gives you the flexibility to remove columns in a table, leaving only the columns useful to your reports. To remove a column from a table, right-click the column and select Delete from the shortcut menu.

Also, you can add the columns back to a table after you have removed them. To do this:

1. Right-click the table to which you want to insert columns, then select Insert Column from the shortcut menu.
2. In the Add Column dialog, select the required columns from the Columns box and click Add to add the columns to the table/view.

   There will be no available column in the Columns box if you do not delete any in the table before. That is to say, you cannot add columns that do not belong to the table.

3. Click the Done button to close the Add Column dialog.

Tip: If you want to add all the columns in a table at a time, you can also choose to refresh the table, which synchronizes the table in catalog with the one in your database.