How to Add a Table Alias to the Dictionary

Top  Previous  Next

An alias creates a second reference for a table without duplicating the table on disk. You can add an alias for a table only if it's already on the Dictionary list.


In the Dictionary Explorer tree, right-click on any table in the list and select Add Alias from the popup menu.


From there, fill in the New Table Alias dialog.

You can also add an alias from the DCT Explorer toolbar when any table is selected.

A table alias creates an additional record buffer for a table on the same thread. That is, an alias lets you define and use two or more different relationships between the same two tables on the same thread. This is really the only compelling reason to use table aliases, since aliases use additional memory and system resources (file handles).

When using aliases it is best to use a database driver that stores keys internally, such as TopSpeed or Btrieve, to conserve file handles.

For example, let's say your hospital application has a patient table and a doctor table. A patient has several doctors: an admitting doctor, a primary doctor, and a surgeon. In database terms, the patient record has three different fields containing doctor IDs, and all three are linking fields to the doctor table (thus, three relationships between the same two tables). If you want to automatically display all the patient's doctors on the same window, you need a record buffer for each link, otherwise, you can show only one doctor at a time--the last one retrieved.

By defining aliases for the doctor table, you can supply additional buffers to hold more than one doctor record at a time. Do not confuse this with the THREAD attribute for a table. The THREAD attribute provides for a separate record buffer for each different thread, whereas an alias provides an additional record buffer on the same thread.

When using aliases, you must open the table for shared access.

You can edit the fields and keys for the Alias by pressing the Edit button in the Field or Keys list. The Field and Key Pads lists the fields and keys for the original table; any changes you make will update the originals.

Next: How to Add Fields to Data Dictionary Tables