<?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: Set Analysis - and use of Variables in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1644854#M63476</link>
    <description>&lt;P&gt;The essential point is that Qlik evaluates always the variable at once - and $(=max(Year)) isn't valid in the script. This meant you couldn't simply create UI expressions as variables within script if they contain such variables.&lt;/P&gt;&lt;P&gt;I'm not very familiar with Sense but in View there would be the suggestion to create such expression-variables within the variable-editor - AFAIK Sense hasn't this native feature but I believe some extensions are available for this.&lt;/P&gt;&lt;P&gt;If not or if it's not practicable enough you could as a workaround replace the $-sign within your variable-content with any unique char (in regard to the usual alphanumeric chars) - maybe chr(1) - and then afterwards replacing it again with the $-sign, like:&lt;/P&gt;&lt;P&gt;let a = 'sum({&amp;lt; F = {"' &amp;amp; chr(1) &amp;amp; '(=max(F))"}&amp;gt; X)';&lt;BR /&gt;let b = replace('$(a)', chr(1), '$');&lt;/P&gt;&lt;P&gt;Alternatively you could load your expressions from a table and assigning then the variables within a loop with their content, like: &lt;A href="http://qlikviewmaven.blogspot.com/2008/12/loading-variables-via-loadscript.html" target="_self"&gt;loading-variables-via-loadscript&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
    <pubDate>Fri, 08 Nov 2019 14:57:32 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2019-11-08T14:57:32Z</dc:date>
    <item>
      <title>Set Analysis - and use of Variables</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1643685#M63469</link>
      <description>&lt;P&gt;I have the following SET anaysis formula which works fine:&lt;/P&gt;&lt;P&gt;sum(&amp;nbsp; {$&amp;lt;type_of_info={EPR}, Year = {$(=max(Year))}&amp;gt;}&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ReportCounter)&lt;/P&gt;&lt;P&gt;However when I try to put this into a variable the Year part does not work&lt;/P&gt;&lt;P&gt;LET vReports = 'sum(&amp;nbsp; {$&amp;lt;type_of_info={EPR}, Year = {$(=max(Year))}&amp;gt;}&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ReportCounter)';&lt;/P&gt;&lt;P&gt;Year is defined as a field of my calendar dimension&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Apr 2021 08:10:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1643685#M63469</guid>
      <dc:creator>andrew_smith200</dc:creator>
      <dc:date>2021-04-02T08:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - and use of Variables</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1643714#M63470</link>
      <description>&lt;P&gt;Are you not getting any data using that variable or It is getting wrong?&lt;/P&gt;&lt;P&gt;Check same variable creating in Variable Overview.. Or try this?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;LET vReports = '=sum({$&amp;lt;type_of_info={'EPR'}, Year = {"$(=max(Year))"}&amp;gt;}&amp;nbsp; ReportCounter)';&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 11:39:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1643714#M63470</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2019-11-06T11:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - and use of Variables</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1643732#M63471</link>
      <description>&lt;P&gt;Thanks but the max year section will not resolve it just leaves the quotes with no value displayed. If you don't put it into a variable it works fine.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 12:15:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1643732#M63471</guid>
      <dc:creator>andrew_smith200</dc:creator>
      <dc:date>2019-11-06T12:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - and use of Variables</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1643775#M63472</link>
      <description>&lt;P&gt;so if you put max(year) into a variable and substitute it in the string it then works when you create the overall variable. Just interesting that it works when not in a variable.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 14:05:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1643775#M63472</guid>
      <dc:creator>andrew_smith200</dc:creator>
      <dc:date>2019-11-06T14:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - and use of Variables</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1643982#M63473</link>
      <description>&lt;P&gt;you have to build the string so the&amp;nbsp;&lt;SPAN&gt;$(=max(Year)) can evaluate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LET vReports = 'sum(&amp;nbsp; {$&amp;lt;type_of_info={EPR}, Year = {' + $(=max(Year)) + '}&amp;gt;}&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ReportCounter)';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Use Test &amp;amp; image to display the value of your variable, the string should contain all evaluated values&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;=Sum(&amp;nbsp; {$&amp;lt;type_of_info={EPR}, Year = {2019}&amp;gt;} ReportCounter)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 20:48:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1643982#M63473</guid>
      <dc:creator>dwforest</dc:creator>
      <dc:date>2019-11-06T20:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - and use of Variables</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1644112#M63474</link>
      <description>&lt;P&gt;Sorry but this doesn't work - I have never seen '+' used in this way. If you remove them it still doesn't work as it doesn't resolve with single quotes. The only way is to create a variable in the load script calling maxyear and then inserting into the variable statement something like this:&lt;/P&gt;&lt;P&gt;tmp:&lt;/P&gt;&lt;P&gt;load max(Year(DateID)as MaxYear resident MasterCalendar;&lt;/P&gt;&lt;P&gt;LET vMaxYear = floor(peek('MaxYear'));&lt;/P&gt;&lt;P&gt;LET vAllreports = 'sum( {$&amp;lt;type_of_info={EPR}, Year = {$(vMaxYear}}&amp;gt;}&amp;nbsp; ReportCounter)';&lt;/P&gt;&lt;P&gt;drop table tmp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 08:51:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1644112#M63474</guid>
      <dc:creator>andrew_smith200</dc:creator>
      <dc:date>2019-11-07T08:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - and use of Variables</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1644617#M63475</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/31054"&gt;@andrew_smith200&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seems there are many Single and double quotes. Qlik doesn't know few of the parts. We need to write as per Qlik. Can you try this way?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;LET vReports = '=sum({$&amp;lt;type_of_info={'&lt;FONT color="#ff0000"&gt;''&lt;/FONT&gt;EPR&lt;FONT color="#ff0000"&gt;''&lt;/FONT&gt;'}, Year = {&lt;FONT color="#ff0000"&gt;''&lt;/FONT&gt;"$(=max(Year))"}&amp;gt;}&amp;nbsp; ReportCounter)'; // &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;Red color part single quote not the double quote.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 07:13:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1644617#M63475</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2019-11-08T07:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - and use of Variables</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1644854#M63476</link>
      <description>&lt;P&gt;The essential point is that Qlik evaluates always the variable at once - and $(=max(Year)) isn't valid in the script. This meant you couldn't simply create UI expressions as variables within script if they contain such variables.&lt;/P&gt;&lt;P&gt;I'm not very familiar with Sense but in View there would be the suggestion to create such expression-variables within the variable-editor - AFAIK Sense hasn't this native feature but I believe some extensions are available for this.&lt;/P&gt;&lt;P&gt;If not or if it's not practicable enough you could as a workaround replace the $-sign within your variable-content with any unique char (in regard to the usual alphanumeric chars) - maybe chr(1) - and then afterwards replacing it again with the $-sign, like:&lt;/P&gt;&lt;P&gt;let a = 'sum({&amp;lt; F = {"' &amp;amp; chr(1) &amp;amp; '(=max(F))"}&amp;gt; X)';&lt;BR /&gt;let b = replace('$(a)', chr(1), '$');&lt;/P&gt;&lt;P&gt;Alternatively you could load your expressions from a table and assigning then the variables within a loop with their content, like: &lt;A href="http://qlikviewmaven.blogspot.com/2008/12/loading-variables-via-loadscript.html" target="_self"&gt;loading-variables-via-loadscript&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 14:57:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-use-of-Variables/m-p/1644854#M63476</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-11-08T14:57:32Z</dc:date>
    </item>
  </channel>
</rss>

