<?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 Help to understand the For function in Qlikview in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-to-understand-the-For-function-in-Qlikview/m-p/689659#M1081641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have plaguerised some code off the internet, which works for what I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I load in my expressions table and then the code loops round and stores the variable as an expression in my QVW&lt;/P&gt;&lt;P&gt;I then use the variable name in my charts/tables and apply dollar expansion to call the expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I do not understand what the FOR function of the code is doing, and I was wondering if someone could explain why I have the&lt;/P&gt;&lt;P&gt;following syntex in my code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone kidnly explain in Leymans Terms?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;For&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;vI&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = 0 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;vNumberOfRows&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; - 1)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Entire Code below&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Expressions:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;LOAD&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Variable&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Replace&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Expression&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, '$', '#') &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;As&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Expression&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;C&gt;&lt;BR /&gt;(&lt;/C&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;biff&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;embedded&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;labels&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;is&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; [Formulas$]);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;Let&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;vNumberOfRows&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;NoOfRows&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;('Expressions');&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;For&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;vI&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = 0 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;vNumberOfRows&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; - 1)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;Let&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;vVariable_Name&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Peek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;('Variable',&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;vI&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,'Expression');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;Let&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;[$(vVariable_Name)]&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Replace&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Peek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;('Expression',&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;vI&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,'Expression'), '#', '$');&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;Next&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Helen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Jul 2014 12:39:13 GMT</pubDate>
    <dc:creator>helen_pip</dc:creator>
    <dc:date>2014-07-01T12:39:13Z</dc:date>
    <item>
      <title>Help to understand the For function in Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Help-to-understand-the-For-function-in-Qlikview/m-p/689659#M1081641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have plaguerised some code off the internet, which works for what I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I load in my expressions table and then the code loops round and stores the variable as an expression in my QVW&lt;/P&gt;&lt;P&gt;I then use the variable name in my charts/tables and apply dollar expansion to call the expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I do not understand what the FOR function of the code is doing, and I was wondering if someone could explain why I have the&lt;/P&gt;&lt;P&gt;following syntex in my code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone kidnly explain in Leymans Terms?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;For&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;vI&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = 0 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;vNumberOfRows&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; - 1)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Entire Code below&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Expressions:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;LOAD&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Variable&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Replace&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Expression&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, '$', '#') &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;As&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Expression&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;C&gt;&lt;BR /&gt;(&lt;/C&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;biff&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;embedded&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;labels&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;is&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; [Formulas$]);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;Let&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;vNumberOfRows&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;NoOfRows&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;('Expressions');&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;For&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;vI&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = 0 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;vNumberOfRows&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; - 1)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;Let&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;vVariable_Name&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Peek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;('Variable',&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;vI&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,'Expression');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;Let&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;[$(vVariable_Name)]&lt;/EM&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Replace&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Peek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;('Expression',&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;vI&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,'Expression'), '#', '$');&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;Next&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Helen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 12:39:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-to-understand-the-For-function-in-Qlikview/m-p/689659#M1081641</guid>
      <dc:creator>helen_pip</dc:creator>
      <dc:date>2014-07-01T12:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help to understand the For function in Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Help-to-understand-the-For-function-in-Qlikview/m-p/689660#M1081642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H1&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;See the help file:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/H1&gt;&lt;H1&gt;&lt;/H1&gt;&lt;H1&gt;For..next&lt;/H1&gt;&lt;P&gt;The &lt;SPAN class="Bold"&gt;for..next&lt;/SPAN&gt; control statement is a script iteration construct with a counter. The statements inside the loop enclosed by &lt;SPAN class="Bold"&gt;for&lt;/SPAN&gt; and &lt;SPAN class="Bold"&gt;next&lt;/SPAN&gt; will be executed for each value of the counter variable between specified low and high limits. The syntax is:&lt;/P&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Bold"&gt;for&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;counter = expr1 &lt;SPAN class="Bold"&gt;to&lt;/SPAN&gt; expr2 [ &lt;SPAN class="Bold"&gt;step&lt;/SPAN&gt; expr3 ]&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Italic"&gt;[statements]&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Italic"&gt;[&lt;SPAN class="Bold"&gt;exit for&lt;/SPAN&gt; [ ( &lt;SPAN class="Bold"&gt;when&lt;/SPAN&gt; | &lt;SPAN class="Bold"&gt;unless&lt;/SPAN&gt; ) condition ]&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Italic"&gt;[statements]&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Bold"&gt;next&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;[counter]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Where:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Italic"&gt;counter&lt;/SPAN&gt; is a variable name. If &lt;SPAN class="Italic"&gt;counter&lt;/SPAN&gt; is specified after &lt;SPAN class="Bold"&gt;next&lt;/SPAN&gt; it must be the same variable name as the one found after the corresponding &lt;SPAN class="Bold"&gt;for&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Italic"&gt;expr1&lt;/SPAN&gt; is an expression which determines the first value of the &lt;SPAN class="Italic"&gt;counter&lt;/SPAN&gt; variable for which the loop should be executed.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Italic"&gt;expr2&lt;/SPAN&gt; is an expression which determines the last value of the &lt;SPAN class="Italic"&gt;counter&lt;/SPAN&gt; variable for which the loop should be executed.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Italic"&gt;expr3&lt;/SPAN&gt; is an expression which determines the value indicating the increment of the &lt;SPAN class="Italic"&gt;counter&lt;/SPAN&gt; variable each time the loop has been executed.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Italic"&gt;condition&lt;/SPAN&gt; is a logical expression evaluating to true or false.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Italic"&gt;statements&lt;/SPAN&gt; is any group of one or more QlikView script statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expressions &lt;SPAN class="Italic"&gt;expr1&lt;/SPAN&gt;, &lt;SPAN class="Italic"&gt;expr2&lt;/SPAN&gt; and &lt;SPAN class="Italic"&gt;expr3&lt;/SPAN&gt; are only evaluated the first time the loop is entered. The value of the counter variable may be changed by statements inside the loop, but this is not good programming practice.&lt;/P&gt;&lt;P&gt;If an &lt;SPAN class="Bold"&gt;exit for&lt;/SPAN&gt; clause is encountered inside the loop, the execution of the script will be transferred to the first statement after the &lt;SPAN class="Bold"&gt;next&lt;/SPAN&gt; clause denoting the end of the loop. An &lt;SPAN class="Bold"&gt;exit for&lt;/SPAN&gt; clause can be made conditional by the optional use of a &lt;SPAN class="Bold"&gt;when&lt;/SPAN&gt; or &lt;SPAN class="Bold"&gt;unless&lt;/SPAN&gt; suffix.&lt;/P&gt;&lt;P&gt;Since the &lt;SPAN class="Bold"&gt;for..next&lt;/SPAN&gt; statement is a control statement and as such is ended with either a semicolon or end-of-line, each of its three possible clauses (&lt;SPAN class="Bold"&gt;for..to..step&lt;/SPAN&gt;, &lt;SPAN class="Bold"&gt;exit for&lt;/SPAN&gt; and &lt;SPAN class="Bold"&gt;next&lt;/SPAN&gt;) must not cross a line boundary.&lt;/P&gt;&lt;P class="example"&gt;Examples:&lt;/P&gt;&lt;P class="Code"&gt;// load files file1.csv..file9.csv&lt;/P&gt;&lt;P class="Code"&gt;FOR a=1 to 9&lt;/P&gt;&lt;P class="Code"&gt;LOAD * FROM file$(a).csv;&lt;/P&gt;&lt;P class="Code"&gt;NEXT&lt;/P&gt;&lt;P class="Code"&gt;&lt;/P&gt;&lt;P class="Code"&gt;FOR counter=1 to 9 step 2&lt;/P&gt;&lt;P class="Code"&gt;SET filename=x$(counter).csv;&lt;/P&gt;&lt;P class="Code"&gt;IF rand( )&amp;lt;0.5 THEN&lt;/P&gt;&lt;P class="Code"&gt;EXIT For Unless counter=1&lt;/P&gt;&lt;P class="Code"&gt;END IF&lt;/P&gt;&lt;P class="Code"&gt;LOAD a,b FROM $(filename);&lt;/P&gt;&lt;P class="Code"&gt;NEXT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 12:42:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-to-understand-the-For-function-in-Qlikview/m-p/689660#M1081642</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2014-07-01T12:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help to understand the For function in Qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/Help-to-understand-the-For-function-in-Qlikview/m-p/689661#M1081643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The FOR construction is the actual loop. It will start at 0 (which is the first entry) and loop to the maximum of rows -1 (which is you last entry). For each found record it executes the Peek and Replace functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR is a common loop in programming languages. It will start at a certain value and then repeat the included statements until a specific value is reached (or a condition is met). The common Syntax is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For &amp;lt;start&amp;gt; to &amp;lt;max value&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;conditions&amp;gt;&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 12:47:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-to-understand-the-For-function-in-Qlikview/m-p/689661#M1081643</guid>
      <dc:creator />
      <dc:date>2014-07-01T12:47:22Z</dc:date>
    </item>
  </channel>
</rss>

