<?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 Is it possible to  use variables in the script, within an IF statement? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211769#M65953</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With the Let statement it works just fine!&lt;/P&gt;&lt;P&gt;Thank you all&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Apr 2011 15:12:29 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-04-12T15:12:29Z</dc:date>
    <item>
      <title>Is it possible to  use variables in the script, within an IF statement?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211764#M65948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I wonder if it is possible to get things working here. What I need to know is, if it is possible to get your If-Statement answers replaced by variables already defined.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;E.g:&lt;BR /&gt;LOAD&lt;BR /&gt;Price,&lt;BR /&gt;Article,&lt;BR /&gt;If(Year = ('A'), x, y)&lt;BR /&gt;FROM&lt;BR /&gt;C:\,,,&lt;BR /&gt;&lt;BR /&gt;Variables:&lt;BR /&gt;for x = CurrentYear =Year(today())&lt;BR /&gt;for y = PreviousYear =Year(today()-365)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;This works propably, but there is a problem replacing the x's and y's with a variable. &lt;BR /&gt;My Goal is to see the value for "CurrentYear" where "A" is in Year in my table. &lt;BR /&gt;I tried almost everything... defining it with $(CurrentYear) but I get an error everytime. &lt;BR /&gt;How does the proper Command would look like?&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&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;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2011 14:39:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211764#M65948</guid>
      <dc:creator />
      <dc:date>2011-04-12T14:39:52Z</dc:date>
    </item>
    <item>
      <title>Is it possible to  use variables in the script, within an IF statement?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211765#M65949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please read the below post. I had used variables as user defined functions by passing the input value and returning a scalar value as output. I hope this should help you...&lt;/P&gt;&lt;P&gt;http://community.qlik.com/forums/t/43601.aspx&lt;/P&gt;&lt;P&gt;You can also post sample QV document with fictitious data and one of us will help you...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2011 14:52:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211765#M65949</guid>
      <dc:creator>IAMDV</dc:creator>
      <dc:date>2011-04-12T14:52:27Z</dc:date>
    </item>
    <item>
      <title>Is it possible to  use variables in the script, within an IF statement?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211766#M65950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should define the variables with 'Let' keyword. Something like this...&lt;/P&gt;&lt;P&gt;Let vCurrentYear =Year(today())&lt;/P&gt;&lt;P&gt;And you can call the variables by using the below syntax...&lt;/P&gt;&lt;P&gt;=$(vCurrentYear)&lt;/P&gt;&lt;P&gt;I hope this helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2011 14:56:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211766#M65950</guid>
      <dc:creator>IAMDV</dc:creator>
      <dc:date>2011-04-12T14:56:16Z</dc:date>
    </item>
    <item>
      <title>Is it possible to  use variables in the script, within an IF statement?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211767#M65951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&lt;/I&gt;&lt;I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Writing an '=' before the $ makes the Synthax light up red!&lt;BR /&gt;&lt;BR /&gt;Thats how I typed it in:&lt;BR /&gt;If(Year = ('A'), &lt;B&gt;&lt;I&gt;$(CurrentYear)&lt;/I&gt;&lt;/B&gt;, &lt;B&gt;&lt;I&gt;$(PreviousYear)&lt;/I&gt;&lt;/B&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;Any clue?&lt;BR /&gt;Thx&lt;B&gt;&lt;BR /&gt;That's my error message;&lt;BR /&gt;&lt;EM&gt;Error in expression: ')' expected&lt;BR /&gt;E.g.:&lt;BR /&gt;LOAD Price,&lt;BR /&gt; Article,&lt;BR /&gt; If(Year = ('A'), =Year(today()), =Year(today()-365))&lt;BR /&gt; FROM&lt;BR /&gt;C:\....xlsx&lt;BR /&gt;(ooxml, embedded labels, table is Tabelle1)&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;As far as I can tell, Qlikview just won't use the value of the variables I defined.&lt;/B&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2011 15:06:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211767#M65951</guid>
      <dc:creator />
      <dc:date>2011-04-12T15:06:35Z</dc:date>
    </item>
    <item>
      <title>Is it possible to  use variables in the script, within an IF statement?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211768#M65952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't have to use the "=" sign before the variable.&lt;/P&gt;&lt;P&gt;In you case you will have to do the next:&lt;/P&gt;&lt;P&gt;if ( Year = 'A' , $(CurrentYear) , $(PreviousYear) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2011 15:10:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211768#M65952</guid>
      <dc:creator />
      <dc:date>2011-04-12T15:10:34Z</dc:date>
    </item>
    <item>
      <title>Is it possible to  use variables in the script, within an IF statement?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211769#M65953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With the Let statement it works just fine!&lt;/P&gt;&lt;P&gt;Thank you all&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2011 15:12:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211769#M65953</guid>
      <dc:creator />
      <dc:date>2011-04-12T15:12:29Z</dc:date>
    </item>
    <item>
      <title>Is it possible to  use variables in the script, within an IF statement?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211770#M65954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am assuming that you are declaring the variable before the Load Script (Because QV reads from Left to Right and Top to Bottom). Please don't use the '=' in the load script and try using ($(vCurrentYear)) instead of $(vCurrentYear)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2011 15:12:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-it-possible-to-use-variables-in-the-script-within-an-IF/m-p/211770#M65954</guid>
      <dc:creator>IAMDV</dc:creator>
      <dc:date>2011-04-12T15:12:35Z</dc:date>
    </item>
  </channel>
</rss>

