<?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: Matching substring in column with another column in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053683#M16677</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hahaha i'm an idiot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;used SUBSTRINGCOUNT several times, then reverted to LEN(KEEPCHAR()) to work out how many times ',' appears! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/blush.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Mar 2016 10:06:14 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-03-18T10:06:14Z</dc:date>
    <item>
      <title>Matching substring in column with another column</title>
      <link>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053676#M16670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here I have two 3 columns states1, states2 and MYstate -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whatever states under state1 and state2,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MY State should have the same state then result as Yes or else no&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="299"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="83"&gt;States1&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="88"&gt;States2&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;MY state&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Result&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="40" style="border-top: none;" width="83"&gt;WA, NY, CA&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;WA, NY&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;CA,WA&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="border-top: none;" width="83"&gt;WA, NY, CA&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;WA, NY&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;CA&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="border-top: none;" width="83"&gt;WA, NY, CA&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;WA, NY&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="border-top: none;" width="83"&gt;WA, NY, CA&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;WA, NY&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;NZ&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am wondering how can I do this with set Analysis .... any thoughts or examples??&lt;/P&gt;&lt;P&gt;Any help is appreciated....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2016 09:19:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053676#M16670</guid>
      <dc:creator />
      <dc:date>2016-03-11T09:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Matching substring in column with another column</title>
      <link>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053677#M16671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If(substringcount(States1, [MY state]) or &lt;SPAN style="font-size: 13.3333px;"&gt;substringcount(States2, [MY state]), 'Yes','No') &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2016 13:29:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053677#M16671</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-03-11T13:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Matching substring in column with another column</title>
      <link>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053678#M16672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think SUBSTRINGCOUNT will only match the entire content of MyState - rather than individual elements e.g. 'CA,WA' in the first record, will not match to States1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could possibly look into the SUBFIELD function - i haven't used it, but it appears to split a string out according to a delimiter. &lt;A href="https://community.qlik.com/docs/DOC-8086"&gt;QlikView String Function cheat sheet&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other than that, the only way i can think is to change your Load Script to create a single line for each element of MyState&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2016 14:03:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053678#M16672</guid>
      <dc:creator />
      <dc:date>2016-03-11T14:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Matching substring in column with another column</title>
      <link>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053679#M16673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so I created two functions in the load script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vSplit = IF(LEN(SUBFIELD($1,',',$2))=0,'',SUBFIELD($1,',',$2));&lt;/P&gt;&lt;P&gt;SET vCheck = IF($(vSplit($2,$3))='',0,SUBSTRINGCOUNT($1,$(vSplit($2,$3))));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then created my calculated expression in the front end as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF(($(vCheck(States1,MyState,1)) + $(vCheck(States1,MyState,2)) + $(vCheck(States2,MyState,1)) + $(vCheck(States2,MyState,2)))&amp;gt;0,'Yes','No')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;only problem is - it is currently limited to 2 elements in MyState (you can extend it my adding $(vCheck(States1,MyState,3)) to the IF&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There might be a way of creating a more complex function which loops through all elements of the MyState - but also something i have never done before!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2016 14:18:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053679#M16673</guid>
      <dc:creator />
      <dc:date>2016-03-11T14:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Matching substring in column with another column</title>
      <link>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053680#M16674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thanks but let me tell know here... the state counts may increase to 'n' number... so I can't do that .. let me know if you have any other solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me give one more example :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 1095px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" width="64"&gt;MY State&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="967"&gt;States1&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="64"&gt;States2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;-&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;,BC,CA,FL,GA,Guangdong,IL,NJ,NULL,ON,TX&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;CA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;-&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;BC,CA,FL,GA,IL,MD,NC,NJ,ON,TX&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;NC&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;CA,TX,VA,FL&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;CA,FL,VA&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;VA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;-&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;AB,AL,AZ,BC,CA,CO,CT,FL,GA,HI,IA,IL ,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NJ,NM,NV,NY,OH,OK,ON,OR,PA,SC,TN,TX,UT,VA,VT,WA,WI&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;TX&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here let me say my state is a super set .... if states in sate 1 + states2 are matching with MY state then Yes or No&lt;/P&gt;&lt;P&gt;So technically if my states have 10 states and states1 have 3 + states 2 have 3 i.e. union of states1 + states2 is 6 if all those 6 states are matching with my state i.e. 6/10 are matching then yes ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;right now I am deriving this logic from sql it self... but I am wondering if I can do this using set analysis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2016 05:59:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053680#M16674</guid>
      <dc:creator />
      <dc:date>2016-03-18T05:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Matching substring in column with another column</title>
      <link>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053681#M16675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think its available in Set Analysis, in the current load format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only way I could find to make it work with n states in MyState, was to change the load script to make use of SUBFIELD() to split MyStates into single records e.g.&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyState,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUBFIELD(MyState,',') AS SubState&lt;/P&gt;&lt;P&gt;RESIDENT &amp;lt;MyStateSource&amp;gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can then use SUM(SUBSTRINGCOUNT(State1,SubState))&amp;gt;0 to determine whether there is a match on State1 and SUM(SUBSTRINGCOUNT(State2,SubState))&amp;gt;0 to determine a match on State2.&lt;/P&gt;&lt;P&gt;LEN(KEEPCHAR(MyState,','))+1 will tell you how many entries are in MyState - SUM(SUBSTRINGCOUNT()) will count how many of those match.&lt;/P&gt;&lt;P&gt;so:&lt;/P&gt;&lt;P&gt;(SUM(SUBSTRINGCOUNT(State1,SubState)) + SUM(SUBSTRINGCOUNT(State2,SubState))) / (LEN(KEEPCHAR(MyState,',')) + 1) would give you the (e.g.) 6/10&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2016 09:10:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053681#M16675</guid>
      <dc:creator />
      <dc:date>2016-03-18T09:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Matching substring in column with another column</title>
      <link>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053682#M16676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See attached example&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2016 09:36:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053682#M16676</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-03-18T09:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Matching substring in column with another column</title>
      <link>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053683#M16677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hahaha i'm an idiot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;used SUBSTRINGCOUNT several times, then reverted to LEN(KEEPCHAR()) to work out how many times ',' appears! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/blush.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2016 10:06:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Matching-substring-in-column-with-another-column/m-p/1053683#M16677</guid>
      <dc:creator />
      <dc:date>2016-03-18T10:06:14Z</dc:date>
    </item>
  </channel>
</rss>

