Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Searching for a substring in a field - fastest way
Message
De
12/03/2017 15:08:23
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., Nouvelle Zélande
 
 
À
09/03/2017 14:30:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01648880
Message ID:
01648951
Vues:
58
>>Is there a quicker way?

LIKE is partly Rushmore optimizable from memory- though it's less likely if your string can be anywhere in the field.
myfleld="Test1Test2"
? LIKE("*Test1*",myfleld)
? LIKE("*Test2*",myfield)
Especially if there's only a few likely matches, I agree with the suggestion to extract matches to a cursor. SET FILTER in a Grid can be terribly slow...

The other thing you might try, is the old PHDBase that still works in VFP9. http://fox.wikis.com/wc.dll?Wiki~PhdBase Pulling records with a string expression can be nearly instantaneous, even with hundreds of thousands of records. Also it has a really good fuzzy search in case somebody misspells MacAdam (sic) and you need to find that needle in a haystack! I'm not sure whether you can still buy it- its author, Jim Korenthal, seemed to change direction many years ago.
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us.
"
-- Shakespeare: Coriolanus, Act 1, scene 1
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform