Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Special Filter
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01090451
Message ID:
01090616
Views:
9
I will show you a trick I use a lot.
lcText='red pencil' && or any string with a variable number of words
lcWord=upper(getwordnum(lcText,1))
Select * from yourtable where lcWord$upper(yourfield) into cursor curdummy readwrite
for x=2 to getwordnum(lcText)
  lcWord=upper(getwordnum(lcText,x))
  Select * from curdummy where lcWord$upper(yourfield) into cursor curdummy readwrite
endfor
Now you will have a cursor which contains all the records where ALL the words in lcText are present in yourfield. You may use this cursor as is if you don't need to be able to edit the table.

If you need to be able to edit the table also, you can simply add these lines:
Index on PK tag PK && PK is primary key or an unique key
Select 0
Use yourtable again
Set relation to PK into curdummy
Set filter to !eof('curdummy')
>I need to filter in a list of products those contaning all words I type. Example:
>
>If I type "red pencils" and my list is:
>
>1-This are red pencils
>2-Somes pencils are red
>3- I need a pencil
>
>Only 1 and 2 satisfy the filter. Any easy way to do this with SET FILTER TO?
Previous
Reply
Map
View

Click here to load this message in the networking platform