Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dealing with set exact on
Message
De
14/04/2009 22:34:05
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
14/04/2009 15:41:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01394811
Message ID:
01394887
Vues:
42
>>It's a software for parking lot that I developed one year ago
>>
>>Car tags standard here are 3 letters and 4 numbers as: QAX9191
>>
>>To prevent customers to type QAX919 (motorcicle or foregner tags) and find the car tag QAX9191 accidently
>>I turned "set exact on"
>>
>>However a customer of mine wants to search only by the car tag number
>>
>>He wants to type 9191 and finds QAX9191
>>
>>The problem is that I use the whole search in unique textbox
>>
>>Is it possible to solve this problem withtout adding another textbox or a "set exact off " button ?
>
>One thing you could do would be to run both exact and inexact/partial queries, and present both sets of results.

Actually, since this is a limited size field, it can be a smart search all the way -

lcTag1="?"+lctag+"*"
lcTag2="??"+lctag+"*"
lcTag3="???"+lctag+"*"

select ..., 1 as rank... where cTag==lcTag ;
union ..., 2 as rank... where cTag=lcTag ;
union ..., 3 as rank... where cTag like lcTag1
union ..., 4 as rank... where cTag like lcTag2

etc etc (of course, build this on-the-fly, depending on the number of the characters entered), then present the final cursor ordered by rank, so the best matches come on top, even if the best match has only a rank of 4.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform