![]() |
Free Trial | ![]() |
![]() |
Indexing on Numerical FieldsA common problem in working with indexes is that people attempt to index on numeric fields types without taking the extra step of using the STR( <field>, <width>) function to pad the data. FoxPro supports calling STR( <field> ) without specifying a width, however Apollo requires a width to be specified. The following works fine under
FoxPro: The equivalent under Apollo is: The value of NUMERICFLD could be different sizes. So, if we assume both STRINGFLD fields are CHAR(10), we would get the following: Rec 1: Using the above index expression, the index values would equate to (# is space): "Charlie###268323Boo####### These index results are different sizes - the second is 2 bytes shorter which results in bad index values leading to incorrect search results. However if you use the STR( <field>, <width>) as STR( NUMERICFLD, 10), you would get the expected result: "Charlie###268323####Boo#######" Both index results are the same size. The same technique applies to the PADL(), PADR(), PADC() padding functions: you would need to make the numeric expression a consistent string width. You need to apply the same logic to your search and scope values and make the values being searched conform to your index expression. SummaryDo not index numeric fields without STR(), PADL() or
PADR(): Index numeric fields as follows: You can also combine numeric fields with non-numeric fields as
follows: |
Using Specific ComponentsKnowledge Base ArticlesSupport Ticket |