<?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 Finding difference between two sets of values in Macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Finding-difference-between-two-sets-of-values-in-Macro/m-p/1522520#M748753</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have&amp;nbsp;for loop in a macro that works off of a set of values and I have the following two sets of values:&lt;/P&gt;&lt;P&gt;Set x= ActiveDocument.Fields("FIELD_1").GetSelectedValues&lt;/P&gt;&lt;P&gt;Set y&lt;SPAN&gt;= ActiveDocument.Fields("&lt;/SPAN&gt;&lt;SPAN&gt;FIELD_2&lt;/SPAN&gt;&lt;SPAN&gt;").GetPossibleValues&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to get all the values that are selected in FIELD_1 and possible in FIELD_2, and do the for loop on those.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In a pseudo-code way, something like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;z=x intersect y&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does anyone know a way I could achieve this in VBScript?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Jamie&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 04:55:58 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-11-16T04:55:58Z</dc:date>
    <item>
      <title>Finding difference between two sets of values in Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-difference-between-two-sets-of-values-in-Macro/m-p/1522520#M748753</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have&amp;nbsp;for loop in a macro that works off of a set of values and I have the following two sets of values:&lt;/P&gt;&lt;P&gt;Set x= ActiveDocument.Fields("FIELD_1").GetSelectedValues&lt;/P&gt;&lt;P&gt;Set y&lt;SPAN&gt;= ActiveDocument.Fields("&lt;/SPAN&gt;&lt;SPAN&gt;FIELD_2&lt;/SPAN&gt;&lt;SPAN&gt;").GetPossibleValues&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to get all the values that are selected in FIELD_1 and possible in FIELD_2, and do the for loop on those.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In a pseudo-code way, something like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;z=x intersect y&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does anyone know a way I could achieve this in VBScript?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Jamie&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 04:55:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-difference-between-two-sets-of-values-in-Macro/m-p/1522520#M748753</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T04:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Finding difference between two sets of values in Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-difference-between-two-sets-of-values-in-Macro/m-p/1522577#M748754</link>
      <description>&lt;P&gt;I'm not sure that I understand what do you want to do because getpossiblevalues from field_2 considered already the selections in field_1.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 12:56:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-difference-between-two-sets-of-values-in-Macro/m-p/1522577#M748754</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2018-12-19T12:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Finding difference between two sets of values in Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-difference-between-two-sets-of-values-in-Macro/m-p/1522586#M748755</link>
      <description>&lt;P&gt;Say that GetSelectedValues from FIELD_1 is (A,B,C,D,E)&lt;/P&gt;&lt;P&gt;Say that GetPossibleValues from FIELD_2 is (C,D,E,F)&lt;/P&gt;&lt;P&gt;I want to catch the intersectional array of (C,D,E) to for loop on&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 13:13:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-difference-between-two-sets-of-values-in-Macro/m-p/1522586#M748755</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-19T13:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Finding difference between two sets of values in Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-difference-between-two-sets-of-values-in-Macro/m-p/1522605#M748756</link>
      <description>&lt;P&gt;Ok. I think I wouldn't do this matching within the vbs else I would try to use the native Qlik functions, for example with something like:&lt;/P&gt;&lt;P&gt;concat({&amp;lt; FIELD_1 = p(FIELD_2)&amp;gt;} distinct FIELD_1, ',')&lt;/P&gt;&lt;P&gt;This could happens within a variable which is then queried in the macro or maybe also with an evaluate() statement in the macro. Something in this way:&lt;/P&gt;&lt;P&gt;var = ActiveDocument.Evaluate("concat({&amp;lt; FIELD_1 = p(FIELD_2)&amp;gt;} distinct FIELD_1, ',')")&lt;BR /&gt;arr = split(var, ",")&lt;/P&gt;&lt;P&gt;for i = 1 to ubound(arr)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ....&lt;BR /&gt;next&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 13:59:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-difference-between-two-sets-of-values-in-Macro/m-p/1522605#M748756</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2018-12-19T13:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Finding difference between two sets of values in Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-difference-between-two-sets-of-values-in-Macro/m-p/1522983#M748757</link>
      <description>&lt;PRE&gt;sub InterSection
    set val1=ActiveDocument.Fields("F1").GetSelectedValues
    set val2=ActiveDocument.Fields("F2").GetPossibleValues
    s=""
    if val1.count &amp;gt; 0 and val2.count &amp;gt; 0 then
        set dic1=CreateObject("Scripting.Dictionary")
        set intersec=CreateObject("Scripting.Dictionary")
        
        for i = 0 to val1.count-1
            dic1.Add val1.Item(i).Text,1
        next        

        for i = 0 to val2.count-1
            if dic1.Exists(val2.Item(i).Text) then
                intersec.Add val2.Item(i).Text,1
            end if
        next        
        
        if intersec.count&amp;gt;0 then
            values=intersec.Keys()
            for i=lbound(values) to ubound(values)
                s = s &amp;amp; values(i) &amp;amp; " "
            next
        else
            s ="No values!"
        end if
    else
            s ="No values!"
    end if
    MsgBox(s)
end sub&lt;/PRE&gt;&lt;P&gt;- Christian&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 12:18:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-difference-between-two-sets-of-values-in-Macro/m-p/1522983#M748757</guid>
      <dc:creator>cwolf</dc:creator>
      <dc:date>2018-12-20T12:18:19Z</dc:date>
    </item>
  </channel>
</rss>

