Setting the Key Column

Imagine your database tracks spare parts stored in a warehouse. Every spare part has its own inventory number that is unique. So you may identify a spare part using the inventory number. In that case the Inventory number column is the Key column that identifies spare part records.

The key column is a column containing values that identify all records in the table. For example, if the ID column is a key column for the Users table, all user records will be identified by their IDs.

To set the key column:

Click the Setup link at the top right corner of the window.

Select a table you need.

From the setup menu select Columns > Set the key column. The system will display the Key Column form:

Set-Key-Column.png

Select a necessary value from the list in the Key Column field.

Click the Save button to save the changes.

The data in the key column should unambiguously identify a table record. When a new table is created, the TeamDesk system creates a special AutoNumber column used for data identification. If necessary, this column may be renamed (for example, into Invoice #).

When the key column is changed, TeamDesk tries to make a new column Required and Unique so that every table record can have its own unique value in the key column. In case of a failure the following errors can occur:

Can not make column ‘name’ required.
Can not make column ‘name’ unique.

If a table uses relationships, the system performs the following succession of actions:

1. A new reference column is created in the detail table. The column is populated with new keys using an old key - reference pair to search for correspondences. Note that not all table cells may be populated - some values may be missing.

2. An old reference column is deleted and all non-found values will be permanently lost at that.

3. A new Lookup column connected with an old key column is created instead of an old reference column.

Next: Managing Access to Columns