How to Index a Field to Force Alpha Sort Before NumericLast reviewed: November 21, 1995Article ID: Q122745 |
The information in this article applies to:
SUMMARYThis article explains how to index a field sorted in ascending order and have alphabetic values listed prior to numeric values -- which is the opposite of what usually happens when values are sorted in ascending order.
MORE INFORMATIONThe following code creates an index on the customer table (located in the FoxPro directory and the tutorial subdirectory). The index uses the Address field to list the records in alphabetical ascending order, placing values that start with a number below values that start with a letter.
SET DEFAULT TO SYS(2004)+"tutorial" USE CUSTOMER INDEX ON IIF(ISALPHA(ADDRESS),"","|")+ADDRESS TAG TEST BROWSEThe IIF expression in the INDEX command places a pipe character (|) in front of any value containing a number as the first digit. The pipe has a higher ASCII value than any alphabetic character, so anything that begins with a pipe is placed after entries that begin with a character. The pipe character is only in the index; it is not in the table (data).
|
Additional reference words: FoxWin FoxDos FoxMac FoxUnix 2.60 2.60a
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |