Sorry for the elementary question, but I am racking my brain trying to figure out the best way to search for a particular character (or string) columnn by column in a table, regardless of where it might be in the cell.
AT( ) Function
Returns the beginning numeric position of the first occurrence of a character expression or memo field within another character expression or memo field, counting from the leftmost character
SELECT * ;
FROM mydbf ;
WHERE ([Z] $ UPPER(myfield1))
* OR
SELECT * ;
FROM mydbf ;
WHERE ([Z] $ UPPER(myfield1) ;
OR ([Z] $ UPPER(mfield2)) ;
OR ([ABC] $ UPPER(mfield3)))
Are you saying that you don't know which field the character will be in? If so, you need to loop through all the fields in the record, something like this:
SELECT MyTable
FOR x = 1 TO FCOUNT()
IF TYPE(x) = "C" OR TYPE(x) = "M"
* Do this with char and memos only
str = EVAL(FIELD(x))
IF AT(SearchChar,str) > 0
* Found
* Take appropriate action here
EXIT
ENDIF
ENDIF
ENDFOR
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.