<?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 in variable in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870340#M71856</link>
    <description>&lt;P&gt;Nothing crazy about it - using dollar sign expansion in the script will result in the dollar sign being expanded in the script. If that didn't happen, all sorts of things wouldn't be possible... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Dec 2021 12:05:32 GMT</pubDate>
    <dc:creator>Or</dc:creator>
    <dc:date>2021-12-14T12:05:32Z</dc:date>
    <item>
      <title>Set Analysis in variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870239#M71850</link>
      <description>&lt;P&gt;I have stored several expressions that I use in a table in the GUI as variables in the script.&amp;nbsp;&lt;BR /&gt;For example: Set vTest = if( condition, 'true', 'false');&amp;nbsp;&lt;BR /&gt;I use them in my table as follows:&amp;nbsp;$(vTest). This works fine except for expressions which include setAnalysis.&lt;BR /&gt;For example:&amp;nbsp;SET vOrder_Quantity = sum( {&amp;lt; Week_Original_Date = {$(=Week(today()))}&amp;gt;} order_quantity);&lt;/P&gt;
&lt;P&gt;What happens is that this variable when called as $(vOrder_Quantity) is interpreted as:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sum( {&amp;lt; Week_Original_Date = {}&amp;gt;} order_quantity);&lt;/P&gt;
&lt;P&gt;The expression $(=Week(today())) is not interpreted correctly. Why is that and how can I put the given expression into a variable. (Needed for usability reasons in NPrint)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 09:52:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870239#M71850</guid>
      <dc:creator>noahfels</dc:creator>
      <dc:date>2021-12-14T09:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis in variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870318#M71853</link>
      <description>&lt;P&gt;Hey, you need to avoid the dollar sign expansion in script, here's how:&lt;/P&gt;
&lt;P&gt;My sample data looks like this:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;DATA:
LOAD * INLINE [
Week_Original_Date,order_quantity
50,100
51,150
52,300
];&lt;/LI-CODE&gt;
&lt;P&gt;Define the variable like this:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;SET vOrder_Quantity = sum( {&amp;lt; Week_Original_Date = {##(=Week(today()))}&amp;gt;} order_quantity);
LET vOrder_Quantity = REPLACE('$(vOrder_Quantity)','##','$');&lt;/LI-CODE&gt;
&lt;P&gt;And in the front-end:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RsQK_0-1639481756690.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/68552i0C5DA54B3472592E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RsQK_0-1639481756690.png" alt="RsQK_0-1639481756690.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 11:36:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870318#M71853</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2021-12-14T11:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis in variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870328#M71855</link>
      <description>&lt;P&gt;That works fine, thank you... kind of crayz though.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 11:52:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870328#M71855</guid>
      <dc:creator>noahfels</dc:creator>
      <dc:date>2021-12-14T11:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis in variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870340#M71856</link>
      <description>&lt;P&gt;Nothing crazy about it - using dollar sign expansion in the script will result in the dollar sign being expanded in the script. If that didn't happen, all sorts of things wouldn't be possible... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 12:05:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870340#M71856</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2021-12-14T12:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis in variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870345#M71857</link>
      <description>&lt;P&gt;Makes sense &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6142"&gt;@Or&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;However&amp;nbsp;now I have a different expression, which also doesn't come back with the correct result:&lt;BR /&gt;set vStock = Sum(Stock) - num(sum(&amp;lt;ProdType = {'defective'} Stock), '#.##0');&amp;nbsp;&lt;BR /&gt;What am I missing here?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 12:10:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870345#M71857</guid>
      <dc:creator>noahfels</dc:creator>
      <dc:date>2021-12-14T12:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis in variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870351#M71858</link>
      <description>&lt;P&gt;Try:&lt;BR /&gt;NUM(Sum(Stock) - sum({&amp;lt;ProdType = {'defective'}&amp;gt;} Stock), '#.##0')&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 12:15:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870351#M71858</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2021-12-14T12:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis in variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870360#M71859</link>
      <description>&lt;P&gt;No idea. Is the ProdType actually 'defective' (case-sensitive)? Also, why are you applying a num to part of the formula, and why not just write this as a single formula?&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt; ProdType -= {'defective'} &amp;gt;} Stock)&lt;/P&gt;
&lt;P&gt;Best bet with this stuff is to use it in a regular chart first, and when it actually works in a chart, move it to a variable (you can also just set the variable manually in the variable editor, which saves you the issue of having to do it in script and deal with dollar sign expansion there).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 12:26:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870360#M71859</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2021-12-14T12:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis in variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870363#M71860</link>
      <description>&lt;P&gt;That does not work for me. The num seems to work fine in different scenarios, however the set Analysis does not seem to work properly.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 12:29:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870363#M71860</guid>
      <dc:creator>noahfels</dc:creator>
      <dc:date>2021-12-14T12:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis in variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870375#M71862</link>
      <description>&lt;P&gt;Ok so I have used the neater expression with -= in the chart and it works fine. However when I store it in my variable:&lt;/P&gt;
&lt;P&gt;Set vStock = Sum({&amp;lt;ProdType -={'defective'}&amp;gt;} Stock);&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and use $(vStock) in the Chart then it gives me the result of Sum(Stock) without the set analysis restriction.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;(I am using the script because I don't have access to the variable editor in a published app)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 12:48:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-in-variable/m-p/1870375#M71862</guid>
      <dc:creator>noahfels</dc:creator>
      <dc:date>2021-12-14T12:48:50Z</dc:date>
    </item>
  </channel>
</rss>

