Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dealing with set exact on
Message
From
14/04/2009 22:34:05
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
14/04/2009 15:41:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01394811
Message ID:
01394887
Views:
40
>>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform