Follow up question to previous thread on VFP 5.0a query questions
NS>Hi
NS>Sorry to be a pain I have almost got the idea now but still have a
NS>couple more questions.
NS>Previously I was told that to perform a search for substrings inside
NS>strings the following would work.
NS>"%string%"
NS>How would I apply this principle to the following:
NS>lcWhereClause = [WHERE &lcSearchField = UPPER(M.lcSearchString)]
NS>SELECT * FROM invt;
NS> &lcWhereClause INTO CURSOR QueryResult
NS>The problems I have are how to attach the % characters to the
NS>M.lcSearchString variable and inserting a LIKE into the statement so
NS>that it works (everytime I tried to use a like it returned no records
NS>found)
Try
lcWhereClause = "WHERE "+lcSearchField+ " LIKE '%"+
UPPER(M.lcSearchString)+"%'"
NS>Also I have a general question on making the searches case
NS>insensitive for example if I used :
NS>lcWhereClause = [WHERE &lcSearchField = (M.lcSearchString)]
NS>and was searching for "Screw" then the search only returned the exact
NS>match (case wise) so{*filter*}or{*filter*}were ignored.
NS>Likewise f I used
NS>lcWhereClause = [WHERE &lcSearchField = UPPER (M.lcSearchString)]
NS>Then only{*filter*}returned records. Is there not a way to make the
NS>queries totally case insensitve and just match on the characters?
Use UPPER or LOWER on both halves of the expression.
lcWhereClause = [WHERE UPPER(&lcSearchField) = UPPER (M.lcSearchString)]
NS>Once again thank you for your time and patience.
NS>Nick Steele
-----------------------------------------------------------------------------
This message was processed by NetXpress from Merlin Systems Inc.
-----------------------------------------------------------------------------