Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

search string with multiple values

I currently have a field where each value is a large amount of free form text.  I am using a variable in Set Analysis to search for certain key words and count how many of these field values contain any of these words.  I also want to allow the end user to enter in (via an input box) the terms for which they want to search.  They could possibly enter only one term or they could enter twenty.  How do you assign those field values to the variable such that the Set Analysis can do an 'OR' search on them (regardless of how they are delimited)?  For example, a User enters in 'cigarette match ashes' in the search field.  How do I create the variable "vTermMatch' such that when the Set Analysis, which is set up as follows:

COUNT({$<[FreeFormText] = {"*$(=vTermMatch)*"}>} [CountTerm])

ends up being equivalent to :

COUNT( {$<[FreeFormText] = {'*cigarette*', '*match*', '*ashes*'}>} [CountTerm])  ?

3 Replies
Gysbert_Wassenaar

Perhaps with another helper variable:

vSM = '{$<[FreeFormText] = {' & chr(39) & '*' & replace( '$(vTermMatch)',' ', '*' & chr(39) & ',' & chr(39)  & '*' ) & '*'  &  Chr(39) & '}>}'

COUNT( $(vSM) [CountTerm])


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you Gysbert.  This was helpful.  Do you have any thoughts as to how this could be done if the user were to enter in a search string where THEYget to determine if it is an "AND" search or an "OR" search?  For example, the user wants to search for "Cigarettes AND ashes" as opposed to "Cigarettes OR ashes". How could you get that entered into Set Analysis.  FYI, I am trying to use Set Analysis so that my charts and tables will update by the search term(s) as well.

Gysbert_Wassenaar

You could try to tinker together something in Qlikview using if-statements and the substringcount function. But that can get ugly quickly. Perhaps you should use something like lucene+solr (lucene.apache.org/solr/) to index and search your texts if you want to do this kind of text analysis.


talk is cheap, supply exceeds demand