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 the table you need.
-
From the setup menu, select
Columns
>Set the key column
. The system will display theKey Column
form:
-
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 system will show you the error.
To solve the error you need to edit the records and make sure that all the values in the key column are unique and not null.
Check "views" to verify whether column records data contains duplicate or null (empty) values. If it does, then edit the records, filling the columns with non-NULL and unique values.
If you don’t see null or duplicate values in the views, try to empty table’s Recycle Bin. Select all records by clicking check box on the table header, and press the "Delete" button.
If a table uses relationships, the system performs the following succession of actions:
-
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.
-
An old reference column is deleted, and all non-found values will be permanently lost at that.
-
A new Lookup column connected with an old key column is created instead of an old reference column.