Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search Multiple Words

Status
Not open for further replies.

Kim296

MIS
Aug 24, 2012
98
US
I have created search parameter fields that allow me to search for a single word or single word phrases (written together) in my notes field. This does work; however, I would like to take this one step further. Instead of it looking for records containing this word OR that word, I would like it to look for records which contain this word AND that word (not necessarily written together)- in a single notes field. I can't figure out how to make this work. The below is the formula (that does work) for returning single word searches. I appreciate any help.


IF INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH1}))>0 THEN TRUE ELSE IF
INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH2}))>0 THEN TRUE ELSE IF
INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH3}))>0 THEN TRUE ELSE IF
INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH4}))>0 THEN TRUE ELSE IF
INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH5}))>0 THEN TRUE ELSE IF
INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH6}))>0 THEN TRUE ELSE IF
INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH7}))>0 THEN TRUE ELSE IF
INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH8}))>0 THEN TRUE ELSE IF
INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH9}))>0 THEN TRUE ELSE IF
INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH10}))>0 THEN TRUE ELSE FALSE

Thank you, Kim
 
example:

IF (INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH1}))>0 AND
INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH3}))>0 AND
INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH5}))>0)
THEN TRUE
ELSE FALSE
 
Thank you andymc! I did try your method before posting my help request. It would not let me do that. Everytime I tried to add "And" in any for or fashion with my formulas, it told me that my formula had an error and would not let me proceed. It would highlight my first section and say that a boolean is required. I tried rewording the formula several times, but nothing I tried worked.
 
I did figure out a way that works, as follows:

IF (INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH1}))>0) AND (INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH2}))>0) THEN TRUE ELSE IF
(INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH3}))>0) AND (INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH4}))>0) THEN TRUE ELSE IF
(INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH5}))>0) AND (INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH6}))>0) THEN TRUE ELSE IF
(INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH7}))>0) AND (INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH8}))>0) THEN TRUE ELSE IF
(INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH9}))>0) AND (INSTR (UPPERCASE({@NOTES}), UPPERCASE({?SEARCH10}))>0) THEN TRUE ELSE FALSE


Thank you for your help.
 
andymc you were right!! I guess I misread your post. Thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top