<?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: Setting and using variables in Qlik Learning Discussions</title>
    <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Setting-and-using-variables/m-p/817585#M2829</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try LET instead of SET ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let me know&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Jan 2015 09:04:23 GMT</pubDate>
    <dc:creator>alexandros17</dc:creator>
    <dc:date>2015-01-20T09:04:23Z</dc:date>
    <item>
      <title>Setting and using variables</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Setting-and-using-variables/m-p/817584#M2828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to QlikView and am stuck with an issue in the script side.&lt;/P&gt;&lt;P&gt;I need to create a variable and store a value, only to be used by the next LOAD statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is how it goes.&lt;/P&gt;&lt;P&gt;FACT:&lt;/P&gt;&lt;P&gt;LOAD fields from FACT.qvd;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET CYEAR=FACT.FISCAL_YEAR;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DIM:&lt;/P&gt;&lt;P&gt;IF($(CYEAR)-DIM.FISCAL_YEAR=0,DIM.FISCAL_WEEK,0)&lt;/P&gt;&lt;P&gt;FROM DIM.qvd;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue is that the $(CYEAR) is replaced by FACT.FISCAL_YEAR when the application is refreshed. And it pops up an error message that the field is not found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jan 2015 09:03:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Setting-and-using-variables/m-p/817584#M2828</guid>
      <dc:creator />
      <dc:date>2015-01-20T09:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Setting and using variables</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Setting-and-using-variables/m-p/817585#M2829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try LET instead of SET ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let me know&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jan 2015 09:04:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Setting-and-using-variables/m-p/817585#M2829</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2015-01-20T09:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Setting and using variables</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Setting-and-using-variables/m-p/817586#M2830</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;For load value from any table use Peek() and for storing use LET rather than SET&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FACT:&lt;/P&gt;&lt;P&gt;LOAD fields from FACT.qvd;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET&lt;/STRONG&gt; CYEAR = &lt;STRONG&gt;Peek('&lt;/STRONG&gt;FACT.FISCAL_YEAR',-1,'FACT');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DIM:&lt;/P&gt;&lt;P&gt;IF($(CYEAR)-DIM.FISCAL_YEAR=0,DIM.FISCAL_WEEK,0)&lt;/P&gt;&lt;P&gt;FROM DIM.qvd;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note:- And what value you need in the variable CYEAR i suppose max year if the order of table is ascending then you get max year value, otherwise provide sample file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jan 2015 09:09:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Setting-and-using-variables/m-p/817586#M2830</guid>
      <dc:creator>its_anandrjs</dc:creator>
      <dc:date>2015-01-20T09:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Setting and using variables</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Setting-and-using-variables/m-p/817587#M2831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LET worked in loading the application with no errors but the data was not as expected.&lt;/P&gt;&lt;P&gt;PEEK worked perfectly.Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jan 2015 09:13:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Setting-and-using-variables/m-p/817587#M2831</guid>
      <dc:creator />
      <dc:date>2015-01-20T09:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Setting and using variables</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Setting-and-using-variables/m-p/817588#M2832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Anand.&lt;/P&gt;&lt;P&gt;Worked like a charm..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jan 2015 09:14:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Setting-and-using-variables/m-p/817588#M2832</guid>
      <dc:creator />
      <dc:date>2015-01-20T09:14:24Z</dc:date>
    </item>
  </channel>
</rss>

