<?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: For Loop with Sub in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/For-Loop-with-Sub/m-p/1301802#M405618</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;The subroutine has to be called upon from a &lt;/SPAN&gt;&lt;SPAN class="statement" data-mc-conditions="Primary.NotToTranslate" style="font-weight: bold; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt; statement. Use call a; at the end. PFA the app for your reference.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;Pratyush&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Jun 2017 07:19:15 GMT</pubDate>
    <dc:creator>prat1507</dc:creator>
    <dc:date>2017-06-16T07:19:15Z</dc:date>
    <item>
      <title>For Loop with Sub</title>
      <link>https://community.qlik.com/t5/QlikView/For-Loop-with-Sub/m-p/1301801#M405617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I was just trying to understand the usage of control statements in qlikview and wrote the below code:&lt;/P&gt;&lt;P&gt;let var1=0;&lt;/P&gt;&lt;P&gt;let var2=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//sub a&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR i = 0 to 10&lt;/P&gt;&lt;P&gt; var1=$(var1)+1;&lt;/P&gt;&lt;P&gt; trace $(var1);&lt;/P&gt;&lt;P&gt; NEXT i&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;//end sub &lt;/P&gt;&lt;P&gt;var2=0+1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; trace $(var2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; This code works as expected but when i uncomment the statements sub a and end sub I get var1=0 and var2=1.&lt;/P&gt;&lt;P&gt;Could someone please let me know whats the logic here, also please advice how i could gain more understanding on these aspects apart from help file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is the qlikview for reference&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jun 2017 06:45:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/For-Loop-with-Sub/m-p/1301801#M405617</guid>
      <dc:creator>anushree1</dc:creator>
      <dc:date>2017-06-16T06:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop with Sub</title>
      <link>https://community.qlik.com/t5/QlikView/For-Loop-with-Sub/m-p/1301802#M405618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;The subroutine has to be called upon from a &lt;/SPAN&gt;&lt;SPAN class="statement" data-mc-conditions="Primary.NotToTranslate" style="font-weight: bold; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt; statement. Use call a; at the end. PFA the app for your reference.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;Pratyush&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jun 2017 07:19:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/For-Loop-with-Sub/m-p/1301802#M405618</guid>
      <dc:creator>prat1507</dc:creator>
      <dc:date>2017-06-16T07:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop with Sub</title>
      <link>https://community.qlik.com/t5/QlikView/For-Loop-with-Sub/m-p/1301803#M405619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Seems, You are not calling Sub function at the end. It should be like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;let var1=0;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;let var2=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;sub a&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;FOR i = 0 to 10&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;var1=$(var1)+1;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;trace $(var1);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;NEXT i&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;end sub&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;var2=0+1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;trace $(var2);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;call a&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jun 2017 07:22:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/For-Loop-with-Sub/m-p/1301803#M405619</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2017-06-16T07:22:53Z</dc:date>
    </item>
  </channel>
</rss>

