Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Search for Whole Word

This is a really basic question.  How do I write out a text search string so that it only selects when the whole word appears, not when it appears as part of another word?  For example, I want to select any time esophageal appears, but not "transesophageal".

Capture.PNG.png

I can do it by placing a space in front of the word, when I am doing a single search, but as part of a longer string (eg (* esophageal*|*bronchoscopy*), it no longer works

Capture.PNG.png

Capture.PNG.png

when placed in the longer string only the bronchoscopy items came through and none of the esophageal...

Thanks!

1 Solution

Accepted Solutions
Highlighted
Partner
Partner

I think I figured out how it works - if you are using the OR search syntax ( | ) and want to use wildcard search, quote every search string in double quotes, like this:

("* esophageal*"|"* bronchoscopy*")

If they have no spaces inside, then the double quotes are not necessary.

Alternative is to use normal search which should be the best for this case. Just enter:

esophageal bronchoscopy

as the search term - no wildcards, no quotes, parentheses or anything else necessary, only search terms separated by spaces - and it will find all strings where either term appears as a full word. Which is incidentally how Dhruv Sampat idea which pointed me in right direction works, it just searches for (, |, and ) as additional words

View solution in original post

7 Replies
Highlighted
Not applicable

try something like:

Assuming your field is called Field1

If((Field1) like 'esphageal*' or (Field1) like '* esphageal *' , 'esphageal' ,

  If((Field1) like 'Bronchoscopy*' or (Field1) like '* Bronchoscopy*' , 'Bronchoscopy' , Field1)) as Field2

Highlighted

*CAR* means that you are searching all the string that contains CAR so you find 'MY CAR' or 'CAR RED'

If you search for CAR* you will find only CAR RED because you are searching for strings starting with CAR and followed by any other string

If you serach 'CA? COLOUR *' you will find all strings starting with CAA, CAB ... CAZ followed by COLOUR and all other strings after

Hope it helps

Highlighted
Partner
Partner

Wow, weird, I'd expect it to work. Either it's a bug or the search OR operator is not very intuitive...

In the meantime, try this as search text instead (make sure there is nothing else in search input field, the equal sign in front is essential):

=WildMatch(CNC_PROCEDURE_DESCRIP,'* esophageal*','* bronchoscopy*')

Highlighted
Creator II
Creator II

The best way is to NOT use the * as the wildcard. Use the space before and after " _esphageal_ | _bronchoscopy_ "

If this helped you, please mark as Helpful. If it solves your issue, please mark as Answer

Regards

Dhruv

Highlighted
Partner
Partner

I think I figured out how it works - if you are using the OR search syntax ( | ) and want to use wildcard search, quote every search string in double quotes, like this:

("* esophageal*"|"* bronchoscopy*")

If they have no spaces inside, then the double quotes are not necessary.

Alternative is to use normal search which should be the best for this case. Just enter:

esophageal bronchoscopy

as the search term - no wildcards, no quotes, parentheses or anything else necessary, only search terms separated by spaces - and it will find all strings where either term appears as a full word. Which is incidentally how Dhruv Sampat idea which pointed me in right direction works, it just searches for (, |, and ) as additional words

View solution in original post

Highlighted
Champion
Champion

type without *

Highlighted
Creator
Creator

Methods that worked:

Normal search and just putting the words in (how did I not try that sooner?)

Capture.PNG.png

Quotation marks and no wildcards.

Capture.PNG.png

The Wildmatch function option also worked.

Capture.PNG.png

Things that didn't work (in addition to the ones in the original question)

Spaces before and after with quotation marks.
Capture.PNG.png

Thanks so much for all the help!!