<?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: Nesting variables in the script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Nesting-variables-in-the-script/m-p/454722#M484933</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Gysbert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It may not be pretty, but the second one worked like a charm.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 May 2013 14:33:23 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-05-15T14:33:23Z</dc:date>
    <item>
      <title>Nesting variables in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Nesting-variables-in-the-script/m-p/454718#M484929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having difficulty getting nested variables and parameters working correctly in the load script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the script that I'm using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TestData:&lt;/P&gt;&lt;P&gt;LOAD * Inline&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Key, Value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ABC, 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DEF, 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;GHI, 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;JKL, 3&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set vTestFor1 = (Value=1);&lt;/P&gt;&lt;P&gt;set vTestFor2 = (Value=2);&lt;/P&gt;&lt;P&gt;set vTestFor3 = (Value=3);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;set vCalcFor2=if($(vTestFor2), 'Y', 'N');&lt;/P&gt;&lt;P&gt;set vCalcForXScript=if($(vTestFor$1), 'Y', 'N');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vCalcForXScript doesn't work - it translates the inner variable at load time. If I set the same value within the Variable Overview, it does work, though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached an example that shows the problem. vCalcForXOverView has been set in the Variable Overview and the chart shows it is working. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I get the same effect, but by setting vCalcForXScript in the script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Ken&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2013 19:48:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nesting-variables-in-the-script/m-p/454718#M484929</guid>
      <dc:creator />
      <dc:date>2013-05-13T19:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting variables in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Nesting-variables-in-the-script/m-p/454719#M484930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ken,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is $ sign in vTestFor$1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set vCalcForXScript=if($(vTestFor1), 'Y', 'N');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the script considers vTestFor$1 as a different variable, which is null.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2013 20:10:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nesting-variables-in-the-script/m-p/454719#M484930</guid>
      <dc:creator>bgerchikov</dc:creator>
      <dc:date>2013-05-13T20:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting variables in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Nesting-variables-in-the-script/m-p/454720#M484931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Boris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The $1 is intentional as I want to be able to specify which function is called based on a parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;For example: If vCalcForXScript is: if($(vTestFor$1), 'Y', 'N');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Then in a chart, the following call would go through the translations: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$(vCalcForXScript(2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// original call&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if($(vTestFor2), 'Y', 'N');&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// substitute vCalcForXScript&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if((Value=2), 'Y', 'N')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// substitute vTestFor2&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Alternatively I could use: $(vCalcForXScript(3)) which would use the vTestFor3 variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;My problem is that if I were to set vCalcForX using the Variable Overview interface, it will work. If I attempt to set vCalcForX in the load script (as per the first post) it translates the variables immediately. (as you pointed out)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;I'm looking for a way to set vCalcForX to contain variables without translating them until later.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;-Ken&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 14:56:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nesting-variables-in-the-script/m-p/454720#M484931</guid>
      <dc:creator />
      <dc:date>2013-05-14T14:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting variables in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Nesting-variables-in-the-script/m-p/454721#M484932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Option 1:&lt;/P&gt;&lt;P&gt;let vCalcForXScript= 'if($' &amp;amp;'(vTestFor$1),' &amp;amp; chr(39) &amp;amp; 'Y' &amp;amp; chr(39) &amp;amp; ','&amp;nbsp; &amp;amp; chr(39) &amp;amp; 'N' &amp;amp; chr(39) &amp;amp; ')';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option 2: &lt;/P&gt;&lt;P&gt;set vT =if(@(vTestFor@1), 'Y', 'N');&lt;/P&gt;&lt;P&gt;let vCalcForXScript = replace('$(vT)', '@','$');&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 15:47:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nesting-variables-in-the-script/m-p/454721#M484932</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-05-14T15:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting variables in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Nesting-variables-in-the-script/m-p/454722#M484933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Gysbert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It may not be pretty, but the second one worked like a charm.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 14:33:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nesting-variables-in-the-script/m-p/454722#M484933</guid>
      <dc:creator />
      <dc:date>2013-05-15T14:33:23Z</dc:date>
    </item>
  </channel>
</rss>

