Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Goofy index with varchar
Message
From
12/02/2010 10:23:02
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01445586
Message ID:
01448937
Views:
34
>>I have an index expression that looks like this "LEAD + UPPER(ST_NAME)". This always worked fine. Both fields were CHARACTER. When I changed LEAD to varchar it stopped working. Changed LEAD back to CHARACTER and it works again. What's up? Is there a work around or should I just abandon varchar?
>
>You have to be more specific about what doesn't work.
>You do realize that index key values are different depending on the data type of 'Lead' field. When 'Lead' is char, the value is padded with spaces to the length of the field. There's no padding when the field is of varchar type.

Hi Sergey -
Sorry it took so long to get back. I've been working in NET recently and had to set my VFP work aside. LEAD is the name of a city like "Tucson". ST_NAME is the name of a roadway project like "Speedway Blvd - Alvernon to Swan". The intent of the index is to do an alpha sort of the records first by the city and then by the project name. With LEAD set to varchar the seemed OK but the second sort broke in the middle and restarted. That is it looked like this:

city1, project1
city1, project2
city1, project3
city1, project1a
city1, project2a

The city names are all entered from a combobox so they should all be the same. I've been thinking about the padding issue you mentioned but I don't think that explains it. :(

(Although if some were entered when the field was CHAR and some when the field was VARCHAR, that may explain it.) :)
Thanks
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform