>In the FPW2.6a version of the app I wrote, I used lots of SET FILTER statements to allow users to find things. Now I now better (yes, I did learn from Jim Booth and company's Top Ten Stupid VFP Coding list!).
>
>What I am trying to do is implement a search and filter class that will let the user enter a phrase and have it search the document titles for that phrase (a CONTAINS search)
>
>In the old days it was:
>
>use q:\qa\qdms2000\qdms!document
>set filter to m.Searchtext $ title
>brow
>
>
>Now (as I understand it) the way to do this is with an SQL statement:
>
>
>select * from q:\qa\qdms2000\qdms!document where l_cSearchtext $ title into cursor temp
>
>
>and then use this cursor as the basis for the grid's record source?
>
Some things to consider would be to use a parameterized view that could be used; advantages include the ability to change the search item and requery() rather than having to change the grid's recordsource, and the option to make the view updatable.
Using a LIKE clause in the WHERE statement might be attractive, too, since you can use more complex wildcarding than a simple $ - % in a string matches any number of characters, _ exactly one, so:
title LIKE "%SM_TH%"
matches SMITH, SMYTHE, etc,
title like "SM%"
matches anything that starts with SM,
title LIKE "% VFP _"
matches anything that ends in something like "VFP 3", "VFP 5", "VFP 6", etc.
The wildcarding isn't an expensive choice, either, and can work with a parameterized view, plus has the benefit of being portable to a backend database engine.
>I have lots of places where this is used in the app, and I wanted to make sure this is the right approach before starting down the road....
>
>Thanks!