DDEditor - indexes

Data dictionary editor - secondary indexes

Secondary indexes are displayed at the bottom of the main screen. A secondary index allows the data in a keyed file to be accessed by different keys and in a different sequence from the main file.

If more than one index exists, the displayed index can be selected from the Indexes listbox at the top right of the secondary index area, or by use of the Next Index and Prev Index buttons. Indexes are listed in alphabetical order of the index name.

Note

The total length of the secondary index fields plus the main index key fields cannot exceed 195 bytes.


Index properties

All properties not included in the table apply to the index as a whole.

Name

The name of the secondary index. When the index is first created a default name of alt_1, alt_2, etc. is assigned to it, the suffix being the lowest still unused. It is recommended that the index name be changed to something more meaningful. The index name is the actual name under which the index will be maintained on the hard disk (with a .k extension). Index names are subject to standard Identifier naming rules. Note also that an index cannot have the same name as a field in the same data dictionary.

Use

A free text field which may be used to supply descriptive comment on the index.

Include records…

If this is unchecked, records which have completely null values in the secondary index key (i.e. alphanumeric fields are blank, and numeric fields contain zero) are excluded from the secondary index. If it is checked, all records in the main index are included in the secondary index, regardless of the content of the fields. The default value is specified by the Configure option.

Open or close…

If this is checked, Sculptor opens and closes the secondary index whenever it opens and closes the main index. If unchecked, the secondary index is opened only when it is used and closed immediately afterwards. This helps to avoid problems associated with operating system limitations on the number of files that a process can have open simultaneously. The default value is specified by the Configure option.


Index field properties

The table displays the fields that are included in the currently displayed secondary index. The right-click menu is used to delete, insert and move fields. To add a new field, select it from the listbox in the Field column.

Field

The field name. The name is selected from a listbox containing the names of all the fields currently defined in the main index. A main index field may appear more than once in the same secondary index, but, unless it is an array field and different elements are selected, this serves no useful purpose and causes unnecessary wastage of disk space.

Type and size

When a field name is selected, the type and size are set initially to those of the corresponding main index field. However, they may be changed. The new type and size are selected in the same way as in the primary index, with the type being chosen from a listbox.

A possible reason to change a field’s size is to create a more compact secondary index. For example, a lengthy alpha field storing a first name or names in the main index could be reduced to an a1 type in the secondary index, if it were sufficient to sort by initial. Changing the type and size of a secondary index field has no effect on the type and size of the main index field of the same name.

See Type and size under The main field table for a list and description of the types and sizes that can be assigned to a data dictionary field. Field types and sizes provides fuller documentation on this topic.

Element

This is a numeric field, which must be set if the corresponding main index field is an array field. It specifies which element of the array is to be used. The value should be an integer in the range 1 - n, where n is the number of elements in the main index field (displayed in the Dims column). If more than one element is required in the secondary key, include the field again and set Element to the new value.

Format

Use this cell to specify a different format for the secondary index field. One possible use of this feature is to give an alphanumeric field the format l+ or u+, causing the index field to be case-independent for sorting and access purposes. The format is not checked for validity.

See Format under The main field table for details of the formats that may be used, and Field formats for full documentation of this topic.


Buttons

The buttons at the bottom of the screen have the following functions:

Prev Index

Displays the previous index.

Next Index

Displays the next index. Indexes are listed in alphabetical order of the index name.

Add Index

Add a new index. A default name of alt_1, alt_2, etc. is assigned to it, the suffix being the lowest still unused. It is expected that the name will be changed to something more meaningful, and focus is accordingly moved to the Name box. However, the names alt_1, alt_2… are perfectly valid and may be retained if required.

Once the name has been assigned, add fields to the index by selection from the listbox in the Field column of the index field table.

Delete Index

Delete the displayed index. A prompt is issued, asking the user to confirm the deletion. A deleted index cannot be restored.


RELATED TOPICS

Data dictionary editor

Secondary indexes

The secondary index table right-click menu

The main field table