<?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 Dynamic Variable in QVS/Load Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Dynamic-Variable-in-QVS-Load-Script/m-p/709403#M255585</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to calculate a bunch of variables that dynamically calculate some KPIs based on a slider. The slider changes the variable "vActualMonth".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I define the variable manually, it works just perfectly fine. When I try to define that variable in the load script or in a QVS, the variable within the variable is replaced with the value and it no longer works dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what I would need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vKPI_AATotalCost = '=Sum({$&amp;lt;RMonth={"&amp;lt;=$(vActualMonth)"}, RType={"Actual"}, AcctCode=&amp;gt;} If(AcctCode &amp;gt;= 6000 AND AcctCode &amp;lt;= 6999, InvAmount))';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I define this in the load script, the variable is defined as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({$&amp;lt;RMonth={"&amp;lt;=6"}, RType={"Actual"}, AcctCode=&amp;gt;} If(AcctCode &amp;gt;= 6000 AND AcctCode &amp;lt;= 6999, InvAmount))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the $(vActualMonth) is replaced with its value 6. How can I prevent this to happen?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I could define the variables manually, but because it's quite a bunch of them, it would be much more efficient, to have that done in the script...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any input.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Oct 2014 08:21:18 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-10-28T08:21:18Z</dc:date>
    <item>
      <title>Dynamic Variable in QVS/Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-Variable-in-QVS-Load-Script/m-p/709403#M255585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to calculate a bunch of variables that dynamically calculate some KPIs based on a slider. The slider changes the variable "vActualMonth".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I define the variable manually, it works just perfectly fine. When I try to define that variable in the load script or in a QVS, the variable within the variable is replaced with the value and it no longer works dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what I would need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vKPI_AATotalCost = '=Sum({$&amp;lt;RMonth={"&amp;lt;=$(vActualMonth)"}, RType={"Actual"}, AcctCode=&amp;gt;} If(AcctCode &amp;gt;= 6000 AND AcctCode &amp;lt;= 6999, InvAmount))';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I define this in the load script, the variable is defined as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({$&amp;lt;RMonth={"&amp;lt;=6"}, RType={"Actual"}, AcctCode=&amp;gt;} If(AcctCode &amp;gt;= 6000 AND AcctCode &amp;lt;= 6999, InvAmount))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the $(vActualMonth) is replaced with its value 6. How can I prevent this to happen?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I could define the variables manually, but because it's quite a bunch of them, it would be much more efficient, to have that done in the script...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any input.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2014 08:21:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-Variable-in-QVS-Load-Script/m-p/709403#M255585</guid>
      <dc:creator />
      <dc:date>2014-10-28T08:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Variable in QVS/Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-Variable-in-QVS-Load-Script/m-p/709404#M255586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One way is to use replace() to use '$' indirectly. Check: &lt;A href="https://community.qlik.com/message/401537"&gt;Re: Variable interpreted in script&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2014 08:29:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-Variable-in-QVS-Load-Script/m-p/709404#M255586</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2014-10-28T08:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Variable in QVS/Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-Variable-in-QVS-Load-Script/m-p/709405#M255587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vActualMonth= 5;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vKPI_AATotalCost = '=Sum({$&amp;lt;RMonth={"&amp;lt;=$' &amp;amp; '(vActualMonth)"}, RType={"Actual"}, AcctCode=&amp;gt;} If(AcctCode &amp;gt;= 6000 AND AcctCode &amp;lt;= 6999, InvAmount))';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2014 08:32:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-Variable-in-QVS-Load-Script/m-p/709405#M255587</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2014-10-28T08:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Variable in QVS/Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-Variable-in-QVS-Load-Script/m-p/709406#M255588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Better expression using only set analysis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vActualMonth= 5;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vKPI_AATotalCost = '=Sum({$&amp;lt;RMonth={"&amp;lt;=$' &amp;amp; '(vActualMonth)"}, RType={"Actual"}, AcctCode={"&amp;gt;=$(6000)&amp;lt;=$(6999)"}&amp;gt;}InvAmount)';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2014 08:35:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-Variable-in-QVS-Load-Script/m-p/709406#M255588</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2014-10-28T08:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Variable in QVS/Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-Variable-in-QVS-Load-Script/m-p/709407#M255589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent. That was what I was looking for. Thanks a million... &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2014 10:05:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-Variable-in-QVS-Load-Script/m-p/709407#M255589</guid>
      <dc:creator />
      <dc:date>2014-10-28T10:05:06Z</dc:date>
    </item>
  </channel>
</rss>

