How to Define an Index

Index definitions, which specify alternative key columns for the table, are part of the table definition in the Repository.

See Indexes.

1.     If you haven't already completed How to Create a Table, do this now.

2.     Open the table definition MyEmployee in the editor.

3.     Select the Indexes tab, which will currently be blank. Select Add Index from the Add menu on the Home ribbon:

4.   A New Index definition is added to the Indexes tab, and the Details tab is opened:

5.     You will now create an index for MyEmployee in the sequence Surname, Given Names and Employee ID. Complete the index details on the Details tab:

Name

MyEmployeeByName

Description (English)

Employees by Name

        Leave the Description (French) as New Index. This can be completed at a later stage.

        Leave other values as their defaults.

        Note: You can select any of these additional attributes and press F1 for their detailed description in the Technical Reference Guide.

6.     Double-click Keys / <New> to open the Details tab for the keys definition. Click the ellipsis button for Column Name to open the Table Columns dialog.

7.     Select xEmployeeSurname and click OK.

8.     Select Add Index Key from the Add menu. Define Column Name using the ellipsis button / Table Columns dialog to xEmployeeGivenNames

9.     Add a third key as xEmployeeIdentification. The Indexes tab should look like the following:

10.   Recompile the table, ensuring that Compile Options are selected to Rebuild indexes and views and Rebuild OAMs.

You can now write code to access the MyEmployee table using the Employees by Name index.