Index on Expressions

File: ...\Samples\Vfp98\Solution\Db\Index2.scx

This index sample shows several options you might consider when using a character field to represent a Unique ID (one often comprised of numeric data). An index tag based on a character field will sort based on the ascii values of the data whereas a numeric expression, using the VAL( ) function, will sort on numeric sequences. The following table shows the sort difference of two indexes:

Cexpression VAL(cExpression
1 1
11 2
2 11

Note   When you use the VAL( ) function, all non-numeric values will be converted to 0.

By incorporating the BINTOC( ) function, you can also reduce the size of your index tags considerably.