- operator example
Suppose you have a DBF table with last name and first name fields, both 16 characters wide. Compare the result of the plus and minus operators:
"Bailey-Richter " + "Gwendolyn " ==> "Bailey-Richter Gwendolyn "
"Bailey-Richter " - "Gwendolyn " ==> "Bailey-RichterGwendolyn "
It may be more useful to include a comma between the last name and first name:
"Bailey-Richter " - "," - "Gwendolyn " ==> "Bailey-Richter,Gwendolyn "
The last name and comma are concatenated, moving the trailing blanks after the comma, then that is concatenated to the first name, moving the trailing blanks after the last name. By separating the last name and first name, the comma ensures that the names are sorted correctly, and it makes searching—particularly interactive incremental searching—easier. The command to create such an index tag would look like:
index on upper( LAST_NAME - "," - FIRST_NAME ) tag FULL_NAME
The minus operator results in index keys that are all the same length, something that you wouldn’t get by using the TRIM( ) function.