#### Tables/Views/Synonyms

Tables, views and synonyms are mapped objects of the tables, views and synonyms in the raw database that a connection refers to. Mapped objects have mapped names that can be different from their names in the raw database. A catalog stores information about the real tables/views/synonyms mapped, such as the name, qualifier, and owner.

Since tables/views/synonyms are only mapped objects, they can be mapped and then re-mapped. That is, the information of the real tables/views/synonyms stored in a catalog is changeable. This is useful when you are off-line from your database. You will still be able to see the table/view/synonym structure and generate reports. In addition, when changing the connection, for example, from an Access database to an Interbase, you will only need to re-map all the tables/views/synonyms in the catalog as opposed to creating a new catalog.

Note: Synonyms are supported for Oracle database only.

##### Adding tables/views/synonyms to a catalog

The way to add tables, views or synonyms stored in the database to a catalog via the JDBC connection you set up is the same. Below is the procedure for adding tables, and you can take the same steps to add views or synonyms to a catalog.

To add tables to a catalog:

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

   The Add Table dialog appears. See the dialog.

2. From the Database Catalogs drop-down list, select the required catalog, then specify a schema in the selected catalog from the Schemas box.
3. Click the Load Tables button. The tables contained in the selected schema will then be displayed in the Tables box.
4. Check the Include System Tables option if you want to have the system tables available in the Tables box.
5. Check Include Added Table to make the tables that have been added to the connection available in the Tables box.
6. Choose the required tables in the Tables box, and then click Add.

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

7. Repeat steps 2 to 4 to add tables from other catalogs and schemas.
8. To add certain tables by name or by patterns in their name, select the Table Name Pattern checkbox. The wildcard % will then be displayed in the text box.

   For example, if you want to add tables beginning with AL, you can type AL% (case sensitive) in the text box, and click the Load Tables button. All the tables beginning with AL in the selected schema will then be displayed in the Tables box. Choose the tables that are required by clicking Add. They will then be added to the connection.

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

Notes:

- When you have added some tables to a catalog, you can then set up pre-joins between them. For detailed information, see Defining the join relationships between tables.
- If you have selected schemas in the Schema tab of the Get JDBC Connection Information dialog when setting up the connection, when you add tables, by default only the selected schemas will be listed in the Schemas box of the Add Table dialog, however, you can check the Show All Schemas option to show all the schemas. It is the same case when adding views.
- When adding tables, if the Include Added Table option is checked in the Add Table dialog, when you click the Add button to add a table that has already been added to the connection once, the Input Table Name dialog will be displayed, prompting you to give the new table a different name. It is the same case when adding views or synonyms.

##### Refreshing tables/views/synonyms

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

##### Organizing tables/views/synonyms

You can organize the tables/views/synonyms, which have been added to a catalog via a JDBC connection, by arranging them in different folders in the Catalog Browser.

To add a folder:

1. Right-click the Tables/Views/Synonyms node, or any existing folder and select Add Folder from the shortcut menu.
2. A new folder is added to the Tables/Views 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/views/synonyms to a folder:

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

##### Removing and adding columns to tables/views/synonyms

By default, when you add a table/view/synonym, you add all the columns reside in the table/view/synonym. However, JReport gives you the flexibility to remove columns in a table/view/synonym, leaving only the columns useful to your reports. Additionally, your database keeps changing over the time. You can add the columns to the table after you delete them or the database has been updated.

To remove a column from a table/view/synonym:

1. Select the column you want to remove.
2. Right-click the column and select Delete from the shortcut menu.

To add columns to a table/view/synonym:

1. Right-click the table/view/synonym 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.

   There will be no available column in the Columns box if you do not delete any in the table/view/synonym before, or no update has been made to the database. That is to say, you cannot add columns that do not belong to the table/view/synonym.

3. Click the Done button to add the columns to the table/view/synonym.

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

##### Previewing the column data of tables/views/synonyms

In the Catalog Browser, you can preview the data for a database column, which enables you to have a general idea about the field contents, field type, and other useful information related to this field.

To preview the data of a column:

1. Right-click the column with the data you want to preview, then on the shortcut menu, click Browse Data.
2. The data of this column is shown in a list in a dialog, which also includes other information including the field type, precision, scale and number of records.