<?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: Script: Using Variables, FOR loops &amp; IF statements in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188798#M627812</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It was yes but it there were some typos (e.g. missing THEN in the first part).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Sep 2016 15:52:38 GMT</pubDate>
    <dc:creator>ciaran_mcgowan</dc:creator>
    <dc:date>2016-09-20T15:52:38Z</dc:date>
    <item>
      <title>Script: Using Variables, FOR loops &amp; IF statements</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188790#M627804</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 have a scenario where I need Qlikview to do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Read all filenames in a folder&lt;/LI&gt;&lt;LI&gt;Store the latest file name as a variable (file name contains dates)&lt;/LI&gt;&lt;LI&gt;Store the number of files in the folder as a variable&lt;/LI&gt;&lt;LI&gt;Store how old the last created fie a&lt;SPAN style="font-size: 13.3333px;"&gt;s a variable (in days)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Using these 3 variables, use an IF statement to determine what the values in a FOR loop are.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have parts 1-4 working but I just can't figure out 5. My scripts are as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14743812172864797" jivemacro_uid="_14743812172864797" modifiedtitle="true"&gt;
&lt;P&gt;Latest_File:&lt;/P&gt;
&lt;P&gt;LOAD &lt;/P&gt;
&lt;P&gt;&amp;nbsp; Mid(FileBaseName(), 10, &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; AS FileName&lt;/P&gt;
&lt;P&gt;FROM &lt;/P&gt;
&lt;P&gt;[..\QVD\1 Extract\E_Report *.qvd];&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14743813656902419" jivemacro_uid="_14743813656902419"&gt;&lt;/PRE&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14743814053088555" jivemacro_uid="_14743814053088555" modifiedtitle="true"&gt;
&lt;P&gt;LET vLatestFile = 'Max(FileName)';&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14743815007994804 jive_text_macro" jivemacro_uid="_14743815007994804" modifiedtitle="true"&gt;
&lt;P&gt;LET vCountFile = 'Count(DISTINCT FileNmae)';&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14743815622005263 jive_text_macro" jivemacro_uid="_14743815622005263" modifiedtitle="true"&gt;
&lt;P&gt;LET vGroupFile = 'Year((Today()) - $(vLatestFile)';&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is what I has for 5 but it's not working;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14743823477894725 jive_text_macro" jivemacro_uid="_14743823477894725" modifiedtitle="true"&gt;
&lt;P&gt;IF $(vCountFile) = 0&lt;/P&gt;
&lt;P&gt;FOR i = Date#(01/01/2000, 'DD/MM/YYYY') TO Date#(31/12/2000, 'DD/MM/YYYY')&lt;/P&gt;
&lt;P&gt;ELSEIF $(vGroupFile) &amp;gt; 5 THEN&lt;/P&gt;
&lt;P&gt;FOR i = $(vLatestSeason) TO $(vLatestSeason) + 5&lt;/P&gt;
&lt;P&gt;ELSE $(vGroupGroup) &amp;lt;= 5 THEN&lt;/P&gt;
&lt;P&gt;FOR i = $(vLatestSeason) TO Today()&lt;/P&gt;
&lt;P&gt;ENDIF&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first part should run if the folder is empty, but only loading the first year of data. The second if will the files load files if the latest one is more than 5 years old - files are very big so this limits the application to pull in no more than 5 years at once. The third part loads all files created within the last five years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 14:44:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188790#M627804</guid>
      <dc:creator>ciaran_mcgowan</dc:creator>
      <dc:date>2016-09-20T14:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Script: Using Variables, FOR loops &amp; IF statements</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188791#M627805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you Need to work with peek&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;LET vLatestFile = &lt;SPAN class="string"&gt;peek('FileName',0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string"&gt;where 0 idicates first row&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string"&gt;you may sort the tabvle before peek and then use peek to get first or last row&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string"&gt;instead of Count you may use NoOfRows('Latest_File')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="string"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 14:49:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188791#M627805</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-20T14:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Script: Using Variables, FOR loops &amp; IF statements</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188792#M627806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333px;"&gt;To explain the peek part...&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Latest_File: &lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;LOAD&amp;nbsp; &lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp; Max(Mid(FileBaseName(), 10, 8)) AS MaxFileName ,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp; Count(Distinct &lt;SPAN style="font-size: 13.3333px;"&gt;FileBaseName()) as CountFileName&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;FROM&amp;nbsp; &lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;[..\QVD\1 Extract\E_Report *.qvd]; &lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Then you can assign it to a variable:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;LET vLatestFile = Num(Date#(&lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;peek('&lt;SPAN style="font-size: 13.3333px;"&gt;MaxFileName&lt;/SPAN&gt;',0), 'YYYYMMDD')); //changed to num so you can calculate the difference in &lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;vGroupFile &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;LET vCountFile = &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;peek('&lt;SPAN style="font-size: 13.3333px;"&gt;CountFileName&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;',0)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN class="string" style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN class="string" style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 15:18:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188792#M627806</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2016-09-20T15:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Script: Using Variables, FOR loops &amp; IF statements</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188793#M627807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rudolf,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you but this isn't the part I'm having an issue with. I can already get the latest file loaded. It is the IF/FOR loop in #5 that I can't get to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 15:20:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188793#M627807</guid>
      <dc:creator>ciaran_mcgowan</dc:creator>
      <dc:date>2016-09-20T15:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Script: Using Variables, FOR loops &amp; IF statements</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188794#M627808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, but the approach I have for #1-4 all work. It's #5 I'm having the issue with.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 15:24:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188794#M627808</guid>
      <dc:creator>ciaran_mcgowan</dc:creator>
      <dc:date>2016-09-20T15:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script: Using Variables, FOR loops &amp; IF statements</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188795#M627809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ciarán, please check in the reload log the values passed to the variables, maybe it doesn't returns an error but I bet it's not using the expected values in step 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specially Today()-&lt;SPAN style="color: #0000ff; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;$(vLatestFile)&lt;/SPAN&gt; won't give you the dates difference, if vLatestFile is 20160919, it will substract 20.160.919 days to today().&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 15:30:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188795#M627809</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2016-09-20T15:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Script: Using Variables, FOR loops &amp; IF statements</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188796#M627810</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;Sorry but there is a typo in part 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of &lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;&lt;EM&gt;Mid(FileBaseName(), 10, &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; &lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN class="keyword" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #006699;"&gt;AS&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;&lt;EM&gt; FileName&lt;/EM&gt; it should read &lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;&lt;EM&gt;Mid(FileBaseName(), 10, 4) &lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN class="keyword" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #006699;"&gt;AS&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;&lt;EM&gt; FileName.&lt;/EM&gt; I am subtracting years, not dates. The variables are returning exactly what I'd expect in the front end so that's why I'm convinced I've made a stupid syntax error in #5.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 15:38:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188796#M627810</guid>
      <dc:creator>ciaran_mcgowan</dc:creator>
      <dc:date>2016-09-20T15:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Script: Using Variables, FOR loops &amp; IF statements</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188797#M627811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a question. Is the code you posted for part 5 really present in your script? Because that isn't legal QlikView Script code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A correct way to write different FOR loop ranges is something like this (pseudo code)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;IF condition_1 THEN&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vLoopStart = &lt;EM&gt;expression1&lt;/EM&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vLoopEnd = &lt;EM&gt;expression2&lt;/EM&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ELSEIF condition_2 THEN&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vLoopStart = &lt;EM&gt;expression3&lt;/EM&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vLoopEnd = &lt;EM&gt;expression4&lt;/EM&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ELSE &lt;SPAN style="font-family: 'courier new', courier; font-size: 13.3333px;"&gt;// Default FOR loop values&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vLoopStart = &lt;EM&gt;expression5&lt;/EM&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vLoopEnd = &lt;EM&gt;expression6&lt;/EM&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;END IF&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FOR i = vLoopStart TO vLoopEnd&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; &lt;EM&gt;Statements&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;NEXT&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Best,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 15:40:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188797#M627811</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-09-20T15:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: Script: Using Variables, FOR loops &amp; IF statements</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188798#M627812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It was yes but it there were some typos (e.g. missing THEN in the first part).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 15:52:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188798#M627812</guid>
      <dc:creator>ciaran_mcgowan</dc:creator>
      <dc:date>2016-09-20T15:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Script: Using Variables, FOR loops &amp; IF statements</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188799#M627813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try with this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;IF vCountFile = 0 THEN&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vLoopStart = MakeDate(2000, 1, 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vLoopEnd = MakeDate(2000, 12, 31);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ELSEIF vGroupFile &amp;gt; 5 THEN&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vLoopStart = vLatestSeason;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vLoopEnd = vLatestSeason + 5;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ELSEIF vGroupGroup &amp;lt;= 5 THEN&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vLoopStart = vLatestSeason;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vLoopEnd = num(Today());&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;END IF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FOR i = vLoopStart TO vLoopEnd&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;NEXT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A few remarks concerning this code:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The loop boundaries aren't set if none of the three IF conditions are met. There is no final ELSE clause. Are you sure about this?&lt;/LI&gt;&lt;LI&gt;Condition 2 uses a variable called &lt;SPAN style="font-family: 'courier new', courier;"&gt;vGroupFile&lt;/SPAN&gt;. Condition 3 uses a variable called &lt;SPAN style="font-family: 'courier new', courier;"&gt;vGroupGroup&lt;/SPAN&gt; that matches all remaining values. Are you sure about this?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 16:05:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Using-Variables-FOR-loops-IF-statements/m-p/1188799#M627813</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-09-20T16:05:11Z</dc:date>
    </item>
  </channel>
</rss>

