>>>>Hi everybody,
>>>>
>>>>In the compound index I use BINTOC function to convert everything to string. So my index expression will look like:
>>>>ccode+town+street+bintoc(stNum)+StNumExt... where stNum is Numeric 4. However, we found, that it sorts things incorrectly, e.g. 109 appears before 84. So, does it mean, what this function could not be used or I have some sort of data corruption...?
>>>>
>>>>Thanks in advance.
>>>
>>>Are you sure ? If your stNums <= 0x7FFFFFFF then it'd sort right.
>>>Cetin
>>
>>What is 0x7FFFFFFF in decimal? My manager showed me, that 109 was sorted prior to 89. I haven't examined it closely, but it seems, like they were sorted incorrectly. So, does it mean, what BINTOC() doesn't work correctly with numbers or I need to investigate this problem for the particular file?
>
>Nadya,
>
>Do BINTOC(84) > BINTOC(109). It'll return false. The number Cetin references is greater than 2 billion. Do ? 0x7FFFFFFF from the command window. The problem that would occur is that values greater than that are assumed to be negative. VFP deals only with signed integers.
Thanks. I found my problem. I used this index expression:
UPPER(STR(galleysort,3)+registry+city+STR(recgrp,1)+street+BINTOC(stnum,2)+stnumext+unit)
However, I should not use UPPER function with BINTOC. So, it's my error and I will now be more careful.
Thanks to you and Cetin.
If it's not broken, fix it until it is.
My Blog