<?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: Qlikview: Using a variable or getFieldSelections in Set Analysis not working instead of hardcoding in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133260#M92092</link>
    <description>&lt;P&gt;Hi, Can you share what the output of the variable is? I.e. add it to a text field to see matches what you expect?&lt;/P&gt;
&lt;P&gt;For it to work it will need to Show as you first working example.&lt;/P&gt;
&lt;PRE class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;'2017-01','2017-02','2017-03','2017-04','2017-05','2017-06'&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;If you are using get field selection you will probably find the syntax return from the variable is incorrect&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 31 Oct 2023 09:47:49 GMT</pubDate>
    <dc:creator>Mark_Little</dc:creator>
    <dc:date>2023-10-31T09:47:49Z</dc:date>
    <item>
      <title>Qlikview: Using a variable or getFieldSelections in Set Analysis not working instead of hardcoding</title>
      <link>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133253#M92091</link>
      <description>&lt;P&gt;Hi, i have witnessed a strange behaviour with set-Analysis Expressions:&lt;/P&gt;
&lt;P&gt;working (Green, "Produktion Set Analysis"):&lt;/P&gt;
&lt;PRE class="lia-indent-padding-left-30px"&gt;Sum (&lt;BR /&gt;&lt;SPAN&gt; {$&amp;lt;d_ultimo_datum_neuabschluss_statistik.jahr_monat_nummer = //begin set analysis&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; {//begin list of values&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; '2017-01','2017-02','2017-03','2017-04','2017-05','2017-06' //debug, hardcoded list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; } //end list of values&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;gt; } //end set analysis&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; neuabschluss_anzahl)&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;not working (Red, "Produktion Set Analysis VAR" using a variable instead of hardcoded list):&lt;/P&gt;
&lt;PRE class="lia-indent-padding-left-30px"&gt;Sum (&lt;BR /&gt;&lt;SPAN&gt; {$&amp;lt;d_ultimo_datum_neuabschluss_statistik.jahr_monat_nummer= //begin set analysis&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; { //begin list of values&lt;/SPAN&gt;&lt;BR /&gt;$(var_Produktionsjahre)&lt;BR /&gt;&lt;SPAN&gt; } //end list of values&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;gt; } //end set analysis&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; neuabschluss_anzahl)&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;variable defintion for "var_Produktionsjahre":&lt;/P&gt;
&lt;PRE class="lia-indent-padding-left-30px"&gt;Chr(39) &amp;amp; //beginning single quote&lt;BR /&gt;Replace( //add single quotations&lt;BR /&gt;GetFieldSelections(d_beginn_datum.jahr_monat_nummer,',',12) //max 12 entries for entire year&lt;BR /&gt;, ',', Chr(39) &amp;amp; ',' &amp;amp; Chr(39)) //close replace&lt;BR /&gt;&amp;amp; Chr(39) //closing single quote &lt;/PRE&gt;
&lt;P&gt;I want to have a user's selection applied to determine the sum in based on Field "neuabschluss_anzahl"&lt;/P&gt;
&lt;P&gt;For testing i've always selected more than one Month, column "Produktion" shows the manually selected data which i want to achieve with a dynamic set-analysis&lt;/P&gt;
&lt;P&gt;The selected fieldvalues and variable output are also shown as expressions in the attached screenshot on the very right &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I've found a different solution in the meantime to achieve my goal, &lt;STRONG&gt;still i want to gather feedback on what i did wrong when using the variable or GetFieldSelections function&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I've browsed through some older posts, but didn't find anything useful on why replacing hardcoded values with a function output does not work. When i try to use double quotes the expression will just return 0&lt;/P&gt;
&lt;P&gt;btw: I'm running &lt;LI-PRODUCT title="QlikView" id="qlikView"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;May 2022 SR2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Christopher&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 09:35:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133253#M92091</guid>
      <dc:creator>ChristopherBirnbaum</dc:creator>
      <dc:date>2023-10-31T09:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Qlikview: Using a variable or getFieldSelections in Set Analysis not working instead of hardcoding</title>
      <link>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133260#M92092</link>
      <description>&lt;P&gt;Hi, Can you share what the output of the variable is? I.e. add it to a text field to see matches what you expect?&lt;/P&gt;
&lt;P&gt;For it to work it will need to Show as you first working example.&lt;/P&gt;
&lt;PRE class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;'2017-01','2017-02','2017-03','2017-04','2017-05','2017-06'&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;If you are using get field selection you will probably find the syntax return from the variable is incorrect&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 09:47:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133260#M92092</guid>
      <dc:creator>Mark_Little</dc:creator>
      <dc:date>2023-10-31T09:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Qlikview: Using a variable or getFieldSelections in Set Analysis not working instead of hardcoding</title>
      <link>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133262#M92093</link>
      <description>&lt;P&gt;hi, variable output is shown in the screenshot, last column. it is exactly as expected:&lt;/P&gt;
&lt;PRE class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;'2017-01','2017-02','2017-03','2017-04','2017-05','2017-06'&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 09:51:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133262#M92093</guid>
      <dc:creator>ChristopherBirnbaum</dc:creator>
      <dc:date>2023-10-31T09:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Qlikview: Using a variable or getFieldSelections in Set Analysis not working instead of hardcoding</title>
      <link>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133736#M92136</link>
      <description>&lt;P&gt;In general should your approach be working. If not it means that the created variable isn't identically with the hard-coded stuff (which is sometimes very hard to detect) and/or the variable isn't appropriate called and/or the variable contains commas which will be treated as parameter-delimiter and not as part of the variable-content.&lt;/P&gt;
&lt;P&gt;So you may try to change the variable-call from:&lt;/P&gt;
&lt;P&gt;$(var_Produktionsjahre)&lt;BR /&gt;to&amp;nbsp;&lt;BR /&gt;var_Produktionsjahre &lt;BR /&gt;&lt;BR /&gt;to prevent the the $-sign expansion or you could try to change the variable-creation to a result of:&lt;/P&gt;
&lt;P&gt;("2017-01"|"2017-02"|"2017-03"|"2017-04"|"2017-05"|"2017-06")&lt;/P&gt;
&lt;P&gt;whereby avoiding the use of strings like 2017-01 and using instead a numeric value of 201701 would simplify such logic significantly because no quoting of the entries would be needed anymore.&lt;/P&gt;
&lt;P&gt;Further you need to be careful with comments within variables. Valide created variables with LET (script) or with the starting = (UI) could contain comments because the content-evaluation happens before the the value-assigning but by the SET creation the comments would become a part of the variables which caused often quite difficult to detecting issues.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Beside of this it's very seldom helpful to use getfieldselections() within a set analysis - much simpler would be to use the selection-functions p() and e(), like:&lt;/P&gt;
&lt;PRE class="lia-indent-padding-left-30px"&gt;Sum(&lt;SPAN&gt;{$&amp;lt;d_ultimo_datum_neuabschluss_statistik.jahr_monat_nummer=&lt;BR /&gt;       p(d_beginn_datum.jahr_monat_nummer)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;}&lt;/SPAN&gt;&lt;SPAN&gt; neuabschluss_anzahl)&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 12:31:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133736#M92136</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-11-01T12:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Qlikview: Using a variable or getFieldSelections in Set Analysis not working instead of hardcoding</title>
      <link>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133789#M92142</link>
      <description>&lt;P&gt;Marcus solution is the best way.&lt;BR /&gt;However, if you want to stick with your variable, could you try to add "=" at the beginning of&amp;nbsp;&lt;SPAN&gt;var_Produktionsjahre definition?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 14:33:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133789#M92142</guid>
      <dc:creator>vincent_ardiet_</dc:creator>
      <dc:date>2023-11-01T14:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Qlikview: Using a variable or getFieldSelections in Set Analysis not working instead of hardcoding</title>
      <link>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133968#M92154</link>
      <description>&lt;P&gt;thank you very much for the explanation and proposed alternative using the "p" function in set analysis - works like a charm!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 06:26:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlikview-Using-a-variable-or-getFieldSelections-in-Set-Analysis/m-p/2133968#M92154</guid>
      <dc:creator>ChristopherBirnbaum</dc:creator>
      <dc:date>2023-11-02T06:26:49Z</dc:date>
    </item>
  </channel>
</rss>

