<?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: Dynamically Using Variables in Set Expression in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Dynamically-Using-Variables-in-Set-Expression/m-p/2490806#M102013</link>
    <description>&lt;P&gt;1. Inside set expression, afaik You cannot use a variable in the place of the field name unless variable is assigned a field. Eg &lt;SPAN&gt;vOrgType1&amp;nbsp;&lt;/SPAN&gt;= NotExistsInNextMonthRN&lt;/P&gt;
&lt;P&gt;2. you should be able to work with&amp;nbsp;&lt;SPAN&gt;vOrgType2 for grouping&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Nov 2024 11:57:46 GMT</pubDate>
    <dc:creator>Qrishna</dc:creator>
    <dc:date>2024-11-05T11:57:46Z</dc:date>
    <item>
      <title>Dynamically Using Variables in Set Expression</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamically-Using-Variables-in-Set-Expression/m-p/2490800#M102010</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I'm working on a set expression in Qlik Sense and need your help to implement dynamic variables in my code. Here's what I have so far:&lt;/P&gt;
&lt;P&gt;Sum(Aggr(&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; If(Sum({&amp;lt;NotExistsInNextMonthRN={1}&amp;gt;} 1) &amp;gt; 0, 1, 0),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; ID, Date, RN&lt;/P&gt;
&lt;P&gt;))&lt;/P&gt;
&lt;P&gt;In my load script, I have defined two variables:&lt;/P&gt;
&lt;P&gt;Set vOrgType1 = 'NotExistsInNextMonth' &amp;amp; GetFieldSelections(OrgLevelType); // text string + selected field (eg. RN)&lt;/P&gt;
&lt;P&gt;Set vOrgType2 = GetFieldSelections(OrgLevelType); // selected field (eg. RN)&lt;/P&gt;
&lt;P&gt;I want to replace the dimension ‘NotExistsInNextMonthRN’ with the variable vOrgType1 and the dimension ‘RN’ with the variable vOrgType2.&lt;/P&gt;
&lt;P&gt;I have tried several options, but none of them work, even though I have tested that both variables evaluate to the correct names.&lt;/P&gt;
&lt;P&gt;How can I apply the values from vOrgType1 and vOrgType2 correctly in my set expression?&lt;/P&gt;
&lt;P&gt;Thank you in advance for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 11:44:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamically-Using-Variables-in-Set-Expression/m-p/2490800#M102010</guid>
      <dc:creator>adh79</dc:creator>
      <dc:date>2024-11-05T11:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Using Variables in Set Expression</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamically-Using-Variables-in-Set-Expression/m-p/2490806#M102013</link>
      <description>&lt;P&gt;1. Inside set expression, afaik You cannot use a variable in the place of the field name unless variable is assigned a field. Eg &lt;SPAN&gt;vOrgType1&amp;nbsp;&lt;/SPAN&gt;= NotExistsInNextMonthRN&lt;/P&gt;
&lt;P&gt;2. you should be able to work with&amp;nbsp;&lt;SPAN&gt;vOrgType2 for grouping&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 11:57:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamically-Using-Variables-in-Set-Expression/m-p/2490806#M102013</guid>
      <dc:creator>Qrishna</dc:creator>
      <dc:date>2024-11-05T11:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Using Variables in Set Expression</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamically-Using-Variables-in-Set-Expression/m-p/2490811#M102015</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/76060"&gt;@adh79&lt;/a&gt;&amp;nbsp; If I understood it correctly, you need to define below variable on front end instead load script&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;vOrgType1&lt;/STRONG&gt; = 'NotExistsInNextMonth' &amp;amp; GetFieldSelections(OrgLevelType)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Then you can use below measure&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Sum(Aggr(&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; If(Sum({&amp;lt;&lt;STRONG&gt;[$(vOrgType1)]&lt;/STRONG&gt;={1}&amp;gt;} 1) &amp;gt; 0, 1, 0),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; ID, Date, RN&lt;/P&gt;
&lt;P&gt;))&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 12:02:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamically-Using-Variables-in-Set-Expression/m-p/2490811#M102015</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-11-05T12:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Using Variables in Set Expression</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamically-Using-Variables-in-Set-Expression/m-p/2491032#M102042</link>
      <description>&lt;P&gt;Thanks. I have changed the logic. It now works.&lt;/P&gt;
&lt;P&gt;Sum(Aggr(&lt;BR /&gt;If(Sum({&amp;lt;[$(='NotExistsInNextMonth' &amp;amp; GetFieldSelections([OrgLevelType]))]={1}&amp;gt;} 1) &amp;gt; 0, 1, 0),&lt;BR /&gt;ID, Date, $(=GetFieldSelections([OrgLevelType]))&lt;BR /&gt;))&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 09:02:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamically-Using-Variables-in-Set-Expression/m-p/2491032#M102042</guid>
      <dc:creator>adh79</dc:creator>
      <dc:date>2024-11-06T09:02:23Z</dc:date>
    </item>
  </channel>
</rss>

