Index on Expressions Sample
File: ...\Samples\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 also can reduce the size of your index tags considerably.