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:
00312894
Vues:
19
> 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?

Nadya,

It depends on what you want to get. ALLTRIM() will find a match if the only difference is trailing spaces bexcause SET EXACT pads the shorter string with space to be equal in length to the longer one before it compares them.

Also, I don't hinm, it is wise to amke a global environemntal setting for just one of the SEEKs. If you do then SEEK "Smi" will not find Smith anymore. IMO, if you need to have an exact match on a seek then make sure the value used by seek is the space length as the field for the index.

For example, if I want to use a vairable and seek it in a table with an index on a field named Name I woudl simply;

SEEK PADR(lcVariable,LEN(Table.Name))

The PADR() pads the string on the right with spaces, the lEN() gets the length of the field I am seeking against. So it ends uyp doing something like this;

lcVariable = "Smi"

* Field Name is 10 characters in length. So ...

PADR(lcVariable,LEN(Table.Name))

resutls in the value of "Smi " with the trailing spaces.

As I said in the beginning though, this all depends on what the required behavior is.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform