<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Check if string contains substring across multiple categories in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Check-if-string-contains-substring-across-multiple-categories/m-p/1443622#M805500</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok I understand now. Thank you for helping me out!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Oct 2017 17:55:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-10-27T17:55:54Z</dc:date>
    <item>
      <title>Check if string contains substring across multiple categories</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-string-contains-substring-across-multiple-categories/m-p/1443618#M805496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys, I have thousands of search phrases that I'd like to flag if the phrase contains an item from the list. Each list can have 100+ items, so coding each item into an if statement isn't ideal. If the search_phrase contains any of the substrings in the list, I need the output to reflect the name of that category. I'd then concatenate all the names of the categories where the search_phrase contains an item from the list. &lt;SPAN style="font-size: 10pt;"&gt;For example: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Strings that need flagging (from QVD file):&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="124" style="border: 1px solid rgb(0, 0, 0); width: 199px; height: 101px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;search_phrase&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;online colleges&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;masters in psychology&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;online finance degree in texas&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;schools that offer free laptops&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The criteria lists (Excel file):&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="124" style="border: 1px solid #000000; width: 659px; height: 94px;" width="657"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;online&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;degree&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;subject&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;geo&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;general&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;laptop&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;online&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;associates&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;psychology&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;georgia&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;colleges&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;laptop&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;on line&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;bachelors&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;finance&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;texas&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;schools&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;tablet&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;on-line&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;masters&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;business administration&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;california&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;programs&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;doctorate&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;nursing&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;maine&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;classes&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Desired output:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="124" style="border: 1px solid rgb(0, 0, 0); width: 514px; height: 115px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;search_phrase&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;flag&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;online colleges&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;online-general&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;masters in psychology&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;degree-subject&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;online finance classes in texas&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;online-subject-geo-general&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;schools that offer free laptops&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;general-laptop&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can handle the concatenating part and cleaning up the flags, but I can't figure out how to get QlikView to check if a string contains a substring within multiple lists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-string-contains-substring-across-multiple-categories/m-p/1443618#M805496</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Check if string contains substring across multiple categories</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-string-contains-substring-across-multiple-categories/m-p/1443619#M805497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Phrase:&lt;/P&gt;&lt;P&gt;LOAD search_phrase&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FROM [&lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2003" data-containertype="14" data-objectid="279459" data-objecttype="1" href="https://community.qlik.com/thread/279459"&gt;https://community.qlik.com/thread/279459&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;(html, codepage is 1252, embedded labels, table is @1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Search:&lt;/P&gt;&lt;P&gt;CROSSTABLE (Topic,Term)&lt;/P&gt;&lt;P&gt;LOAD Recno(), online, degree, subject, geo, general, laptop&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FROM [&lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2003" data-containertype="14" data-objectid="279459" data-objecttype="1" href="https://community.qlik.com/thread/279459"&gt;https://community.qlik.com/thread/279459&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;(html, codepage is 1252, embedded labels, table is @2);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MAP:&lt;/P&gt;&lt;P&gt;MAPPING&lt;/P&gt;&lt;P&gt;LOAD Term, '//'&amp;amp; Topic &amp;amp; '\\' as Replace&lt;/P&gt;&lt;P&gt;Resident Search;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;LOAD search_phrase, Concat(submapped, '-',subID) as result&lt;/P&gt;&lt;P&gt;GROUP BY search_phrase;&lt;/P&gt;&lt;P&gt;LOAD search_phrase, TextBetween(mapped,'//','\\',iterno()) as submapped, iterno() as subID&lt;/P&gt;&lt;P&gt;WHILE iterno() &amp;lt;= SubStringCount(mapped,'//');&lt;/P&gt;&lt;P&gt;LOAD search_phrase, MapSubString('MAP', search_phrase) as mapped&lt;/P&gt;&lt;P&gt;Resident Phrase;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE Phrase;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Oct 2017 22:02:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-string-contains-substring-across-multiple-categories/m-p/1443619#M805497</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2017-10-26T22:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Check if string contains substring across multiple categories</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-string-contains-substring-across-multiple-categories/m-p/1443620#M805498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Incredible, it worked! Thank you very much for the quick response. I hadn't used most of those functions before, but I will acquaint myself with them now. Do you mind explaining how that Result table works though? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Oct 2017 23:53:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-string-contains-substring-across-multiple-categories/m-p/1443620#M805498</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-26T23:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Check if string contains substring across multiple categories</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-string-contains-substring-across-multiple-categories/m-p/1443621#M805499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ben,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look (e.g. in a table box) at the Search table transformed using CROSSTABLE LOAD prefix:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/3628"&gt;The Crosstable Load&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I've created a MAPPING table&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/2756"&gt;Don't join - use Applymap instead&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but used the Mapsubstring() function in the Result Table LOAD to replace all ocurrences of the search Terms with a //Topic\\ code.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/MappingFunctions/MapSubstring.htm" title="http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/MappingFunctions/MapSubstring.htm"&gt;MapSubstring ‒ QlikView&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Result table preceding LOADs need to be read bottom to top, so the LOAD with the MapSubstring() is done first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Comment out the upper two LOAD statements and reload to see the mapped results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second LOAD from the bottom now creates a record per found //Topic\\ code (use other delimiters than // and \\ if these may conflict with your searched content) using a WHILE loop.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/3274"&gt;Loops in the Script&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/ScriptRegularStatements/Load.htm" title="http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/ScriptRegularStatements/Load.htm"&gt;Load ‒ QlikView (see the WHILE clause)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Comment out only the topmost LOAD statement to have a look at the single records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The last (topmost) LOAD then aggregates the records per search_phrase and creates a concatenated string for the found Topic values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2017 08:49:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-string-contains-substring-across-multiple-categories/m-p/1443621#M805499</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2017-10-27T08:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Check if string contains substring across multiple categories</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-string-contains-substring-across-multiple-categories/m-p/1443622#M805500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok I understand now. Thank you for helping me out!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2017 17:55:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-string-contains-substring-across-multiple-categories/m-p/1443622#M805500</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-27T17:55:54Z</dc:date>
    </item>
  </channel>
</rss>

