<?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 Using a variable in the script when it contains an = expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-a-variable-in-the-script-when-it-contains-an-expression/m-p/248222#M94496</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Are you using the keyword &lt;EM&gt;&lt;STRONG&gt;LET&lt;/STRONG&gt;&lt;/EM&gt; instead of &lt;EM&gt;&lt;STRONG&gt;SET&lt;/STRONG&gt;&lt;/EM&gt;?&amp;nbsp;&amp;nbsp; If your loadscript statement is something like&amp;nbsp;&amp;nbsp; LET myvar=YEARSTART(TODAY(2)-2);&amp;nbsp; then QlikView will evaluate the expression to the right of the equal sign and put the result into the variable. If you write the same statement using &lt;EM&gt;SET&lt;/EM&gt; then QlikView will store the expression text in the variable without evaluating it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 May 2011 18:26:38 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-05-31T18:26:38Z</dc:date>
    <item>
      <title>Using a variable in the script when it contains an = expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-a-variable-in-the-script-when-it-contains-an-expression/m-p/248220#M94494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a variable that contains an expression to calculate a date. In the background of this screenshot you can see a text box that correctly evaluates the expression as a date. &lt;/P&gt;&lt;P&gt;&lt;IMG alt="Picture1.png" class="jive-image-thumbnail jive-image" onclick="" src="https://community.qlik.com/legacyfs/online/4790_Picture1.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I use the same variable in a load script, QlikView insists on inserting the expression itself into the script, not the evaluated results. What gives? The reference manual says that &lt;EM&gt;if the first character of a variable value is "=", QlikView will try to evaluate the value as a formula and insert the result&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found that the script will evaluate the variable only if I remove the "=", but sheet objects evaluate the variable only if I include the "=" -- the exact opposite.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing something here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 May 2011 18:41:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-a-variable-in-the-script-when-it-contains-an-expression/m-p/248220#M94494</guid>
      <dc:creator>jcarpenter9</dc:creator>
      <dc:date>2011-05-27T18:41:32Z</dc:date>
    </item>
    <item>
      <title>Using a variable in the script when it contains an = expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-a-variable-in-the-script-when-it-contains-an-expression/m-p/248221#M94495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;maybe you can create two versions of the same variable. One with the = and other without it. &lt;/P&gt;&lt;P&gt;Or you can call the variable on the sheet objects forcing a = &lt;/P&gt;&lt;P&gt;something like $(=variable1) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 May 2011 23:54:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-a-variable-in-the-script-when-it-contains-an-expression/m-p/248221#M94495</guid>
      <dc:creator>erichshiino</dc:creator>
      <dc:date>2011-05-27T23:54:27Z</dc:date>
    </item>
    <item>
      <title>Using a variable in the script when it contains an = expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-a-variable-in-the-script-when-it-contains-an-expression/m-p/248222#M94496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Are you using the keyword &lt;EM&gt;&lt;STRONG&gt;LET&lt;/STRONG&gt;&lt;/EM&gt; instead of &lt;EM&gt;&lt;STRONG&gt;SET&lt;/STRONG&gt;&lt;/EM&gt;?&amp;nbsp;&amp;nbsp; If your loadscript statement is something like&amp;nbsp;&amp;nbsp; LET myvar=YEARSTART(TODAY(2)-2);&amp;nbsp; then QlikView will evaluate the expression to the right of the equal sign and put the result into the variable. If you write the same statement using &lt;EM&gt;SET&lt;/EM&gt; then QlikView will store the expression text in the variable without evaluating it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2011 18:26:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-a-variable-in-the-script-when-it-contains-an-expression/m-p/248222#M94496</guid>
      <dc:creator />
      <dc:date>2011-05-31T18:26:38Z</dc:date>
    </item>
    <item>
      <title>Using a variable in the script when it contains an = expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-a-variable-in-the-script-when-it-contains-an-expression/m-p/248223#M94497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I understand the LET/SET distinction. However, the variable already contains the expression text starting with "=", so I thought the load script would replace the variable with the evaluated result. Instead, it inserts the expression itself into the script, which causes a syntax error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ended up coding LET vARCHIVE_DATE=YEARSTART(TODAY(2)-2); and then placing $(vARCHIVE_DATE) into the code later.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this is not consistent with the way the reference manual says variables should operate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for everyone's feedback.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2011 15:10:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-a-variable-in-the-script-when-it-contains-an-expression/m-p/248223#M94497</guid>
      <dc:creator>jcarpenter9</dc:creator>
      <dc:date>2011-06-01T15:10:09Z</dc:date>
    </item>
  </channel>
</rss>

