Rules for dBASE complex indexes
For complex dBASE indexes, the complexity of the index expression varies according to the way the index is used. The following rules apply when defining complex indexes:
An index value can be up to 100 characters long. The text of the key expression can be up to 220 characters long.
The complex index must be a valid dBASE expression. Note that a single field name is a valid expression.
The expression must evaluate to a character, date, numeric, or float value.
It usually, but not always, contains at least one field name.
For multiple character fields, concatenate, or combine, fields using the plus sign (+), as shown in the following examples:
LAST_NAME + FIRST_NAME + M_INITIAL
CUSTOMER + ORDER_NO
You can concatenate fields of different data types by converting them to a single type. In the following example, the key expression concatenates the CUSTOMER_N field, which is a character field, and ORDER_DATE, which is a date field. The DTOS( ) function converts the date value to a character string in the format YYYYMMDD. This order—year first, then month, then day—ensures accurate indexing.
CUSTOMER_N + DTOS(ORDER_DATE)
For converting number fields, use the STR( ) function. Include the width and number of decimal places of the numeric field(s), to ensure accuracy of the index. For example, suppose you are creating an index that includes a character field LNAME, and a numeric field called AMOUNT that is 10 places wide with 2 decimal places. Use the following syntax:
LNAME+STR(AMOUNT,10,2)