Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Seek - not exact search? What does influence on it?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00312453
Message ID:
00312588
Vues:
17
Hi Jim,
>>
>>Today I found that function seek() does not exact search. Does it respect exact settings? I didn't notice this before...
>>
>>Test example: (haven't checked exact settings)
>>
>>create cursor hhh (code C(5))
>>select hhh
>>for i=10000 to 99999
>>  insert into hhh value (alltrim(str(i)))
>>endfor
>>index on code tag code
>>? seek('111','hhh','code') && return .t.
>>
>
>Nadya,
>
>SEEK is affected by the SET EXACT setting as to whether partial mathces are considered hits or not.
>
>The safest way to enforce exact matching is;
>
>? SEEK(PADR("111",LEN(hhh),"0"), "hhh","code")
>
>This pads your string search with 0's to match the length of your field. Since the == operator is not available in the SEEK command or function this is the way to get an exact match. SETting EXACT ON will not differentiate with two values that have trialing spaces as their difference.

What about seek(alltrim('111'),'hhh',code')? I would also assume, that I have values without trailing spaces in my cursor. And I already put set exact on just before seek() function. Is not this enough?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform