Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with index in VFP9.0
Message
De
17/01/2005 03:38:36
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00973359
Message ID:
00977673
Vues:
41
You should be happy that you have never had any problems with variable length index key before, or maybe you simply have not noticed? If you absolutely need to use the alltrim(), or any of the other trim variants for that matter, you need to pad the index key so they give a fixed length key.

In the earlier message, ALLTRIM(STR(add_type))+DTOC(startd8)+ALLTRIM(STR(fk_patients)) should be changed into PADR(ALLTRIM(STR(add_type))+DTOC(startd8)+ALLTRIM(STR(fk_patients)),25). 25 is just my guess. As Kelly Conway wrote, VFP9 will automatically pad the index key, but why not take the control yourself, and not leave it to VFP9? VFP9 will evaluate the first record to calculate the index key length, and if the index expression includes data from a memo field, VFP9 may calculate the wrong length.

>I have just begun to test some of my existing apps with VFP9 and have noticed the same behavior...Indexes with Variable Length components which worked on all previous versions now generate an error. Apparently VFP9 is much less forgiving than previous versions.
>
>>Hi Ronald,
>>
>>>ALLTRIM(STR(add_type))+DTOC(startd8,1)+ALLTRIM(STR(fk_patients))
>>>
>>
>>This is improper key expression. DTOC(startd8) behaves differently depending on the current SET CENTURY and SET DATE, you should use DTOC(startd8,1) instead.
>>
>>Thanks,
>>Aleksey.
>>
>>
>>
>>>The following index in VFP9.0 beta worked fine when doing an insert into the table:
>>>
>>>
>>>ALLTRIM(STR(add_type))+DTOC(startd8)+ALLTRIM(STR(fk_patients))
>>>
>>>where add_type is an integer field,
>>>startd8 is a date field,
>>>and fk_patients is an integer
>>>
>>>Today, I finally downloaded released VFP9.0 and am getting the following error:
>>>
>>>"Error building key for Index ..."
>>>
>>>Removal of index program runs fine and then adding index back in seems to work.
>>>
>>>Can anyone give me a hint as to why the above index is giving me trouble?
>>>
>>>Thanks in advance
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform