User Tools

Site Tools


how_to_create_a_key.htm
Navigation:  IDE FAQs > Dictionaries > How to… >====== How to Create a Key ====== Previous pageReturn to chapter overviewNext page

Add and edit keys and indexes using the Keys pad found in the Quick View panel.

Keys are automatically updated whenever records are added, changed, or deleted. Index files do not update automatically. A BUILD statement is required to update an index.

1.Select a table from the DCT Explorer list on the Tables side of the Dictionary dialog and press the Add button found on the Keys pad.

The Key Properties dialog appears.

2.Type a valid Clarion label in the Label field.

3.Optionally type a Description. This displays in various dialog boxes, including the File Definition dialog.

4.In the Attributes and Type group boxes select a key type and check all boxes that are appropriate for the key.

A runtime index allows you to declare an index without specifying the key component fields in the Data Dictionary. The application must define the key component fields at runtime, as the second parameter of the BUILD statement. The application may rebuild the same index file at a later time, specifying different key component columns for the index.

5.Optionally type a valid DOS file name in the External Name field, if the file system needs one.

Clarion automatically adds the proper file extension.

6.Select the Columns tab, then press the Add button.

The Select a Field list appears.

7.DOUBLE-CLICK a field in the list;

This transfers its name to the Columns tab, which indicates the field will be part of the new key. Repeat steps 8 and 9 to add more fields to the key.

8.Press OK to close the Key Properties dialog.

The Key Properties dialog appears again, ready to accept additional keys.

9.Repeat steps 4 through 10 to create additional keys for this file.

10.When you are finished adding keys, press Cancel to close the Key Properties dialog and return to the Quick View panel.

At the end of the process, your keys appear in the Keys pad, with their field components arranged in order, one above the other in a tree diagram.

To modify a key, select the key and press the Change button in the Keys pad. The Entity Browser for that key's table appears, and the Key Properties dialog appears just to the right of the Entity Browser. If you selected a key component, the Columns tab is on top. If you selected the key, the General tab is on top.

Next: How to Define Table Relationships and Referential Integrity

how_to_create_a_key.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1