Electrical Design Software | Elecdes Design Suite by Scada Systems Ltd

How to Modify the Database Structure

Instrument Manager provides this tool to add, delete and modify columns in the component ratings tables. This avoids the need to learn and use another program for the most common changes you would make to a project database. The tool also provides features specific to Instrument Manager, for example synchronising ratings tables with output diagram templates.

Procedure

  1. Ensure no other users have this project open and ensure they will not open it during the addition or removal of columns.

  2. From the Tools menu, select Database Structure Editor.

  3. Select one or more tables to modify then click OK.

  4. Alternatively, you can edit the ratings table for the folder currently selected in the tree if you right click on the folder and choose Modify table structure... from the pop-up menu.

  5. The existing columns in the tables are loaded, along with column references from the datasheet and hookup diagram templates used by the components in the tables.

    Each row in the list represents one column from one of the selected tables.

    Table and Original Name show the containing table and the original name of the column. If the column is renamed then the new name is under New Name.

    Width shows the current maximum width of text that the column can contain. This is the column width in the database table definition.

    Required Width shows the width of the longest data value entered into that column in the table. If you reduce the column width below this value then existing data will be truncated.

    Rating in Datasheets and Rating in Hookups show the names of any datasheet or hookup diagram templates that refer to the column and that are used by the existing component records in the table.

  6. Warnings / Errors, at the bottom of the dialog, shows details for any of the changes that are incorrect, e.g. duplication of a column in one table.

  7. Right click on the list to see various common editing and sorting tools for grid editors. Most of these are the same as the editing options in Database Editor. You can use these tools as required to help you build names for columns.

  8. Click Select Tables... to change which tables are being edited. If you have unsaved changes you will be prompted to apply them before changing tables.

  9. Click Apply to save your current changes. After saving you can continue to make other changes or select other tables.

  10. Click OK to close the database structure editor. If you have unsaved changes you will be prompted to apply them.

  11. Click Cancel to discard any unsaved changes and close the database structure editor.

Add a new column to one table or all tables

  1. Choose which table the new column will be added to.

    You can choose to have the new column added to all of the currently selected tables by selecting <All Chosen Tables ()>, or select any one specific table from those that were initially selected.

  2. Enter a Name for the new column and enter the Width of text that the column can contain.

  3. Click Add to add the new column to the selected table(s).

    The entry for the new column in each selected table will be added to the bottom of the list.

    Original Name in the list will show (new) for the new columns.

    If the column already existed in any of the selected tables then it will not appear as a new entry for that table.

  4. The tables will not be modified until you click Apply, or click OK and choose to apply the changes.

Quick addition of a column

  1. If you are modifying only one table, click anywhere on the last entry in the list then press Enter to add a new mostly empty row to the list.

    You define the new column in this new row in the list.

  2. On the new last row, click into the empty cell under New Name and enter a name, then under Width and enter the width for the new column.

  3. The tables will not be modified until you click Apply, or click OK and choose to apply the changes.

If you have pressed Enter at the bottom of the list and created an empty entry for a new column that you do not want, you can click on that row and click Delete selected column(s) to remove it. However, it is safe to ignore unwanted empty rows since database structure editor will not add a column with no name.

Rename a column or change its witdh

  1. In the list, on the row for the column that you want to change:

    • Click on the column name under New Name and change the column name.

    • Click on the number under Width and change the column width.

  2. The tables will not be modified until you click Apply, or click OK and choose to apply the changes.

Delete columns

  1. In the list, click and drag to select the rows for the columns that you want to delete.

  2. Click Delete selected columns(s).

    The rows for those columns will be removed from the list.

    Existing columns that have been deleted are added to the combo box under Deleted Columns, from which they can be restored prior to applying the changes.

    New columns are simply deleted.

  3. The tables will not be modified until you click Apply, or click OK and choose to apply the changes.

    After you click Apply, the columns are removed from the database table. They are also removed from the combo box since they can no longer be restored with data (although you can re-create a column with the same name).

Restore deleted columns (before applying changes)

The tables are modified only after you click Apply, or click OK and choose to apply the changes. Prior to that you are staging the changes that you want to make to the tables. If you have prepared to delete columns that you now do not want to delete, and you have not yet applied the changes, you can restore those column definitions to the list.

  • Either, select a single column to be restored from the combo box under Deleted Columns then click the Restore button.

  • Or, click Restore All to restore all of the columns that you have marked to be deleted (but have not yet applied).

Synchronise with output diagram templates

The majority of the columns in the ratings tables are used to store information to show on output diagrams, in particular datasheets and hookup diagrams. The database structure editor can help you to synchronise the columns in your database tables with the references to columns in formulae on the datasheet and hookup diagram templates.

The Access database format has a limit of 255 columns per table. If you are customising your diagram templates you may find that you need to add your own columns and therefore need to delete unused columns from the ratings tables to remain below this limit.

  1. Tick Add columns present in datasheets and hookups if your diagram templates refer to columns that are not in your ratings tables and you want to add storage for the data to show in those formulae on the diagrams.

  2. Tick Remove empty columns not in any datasheet or hookup if your ratings tables contain columns that are not being used on your diagram templates and you want to remove unused columns from your tables.

    Columns that have values (are not empty) will not be deleted since they are used, even if their data is not shown on the datasheet and hookup diagrams.

    Note that this synchronisation does not check loop diagram templates. Take care to check if ratings table columns that are suggested to be deleted actually are used (but only on loop diagrams) and therefore should not be deleted.

  3. Click Synchronise Rating tables...

  4. The procedure will search for all unsynchronised columns.

    A dialog will be shown to choose columns to be added, and a separate dialog for columns to be deleted. In each dialog, select only those columns that you want to add or delete.

  5. Entries for new columns will be added into the list of columns on the dialog.

    Entries for columns to be deleted will be removed from the list on the dialog and added to the combo box under Deleted Columns. You can choose to restore them at this time if you have mistakenly marked a column to be deleted.

  6. The tables will not be modified until you click Apply, or click OK and choose to apply the changes.

    After you click Apply, the database table is modified.

    The Deleted Columns combo box is emptied since those columns can no longer be restored (although you can re-create a column with the same name).

See also:

Database Structure Overview

Creating a Project and Database

Project Database Template

Output Diagrams

Output Diagram Templates