<?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: Do While ...Loop continued working after the condition became invalid in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12289#M607885</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not sure but I think you don't need to use &lt;STRONG&gt;'Let' &lt;/STRONG&gt; in below statement as the variable is already defined at the top, looks like its kind of creating FirstYear newly inside the loop - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&amp;nbsp; Let&amp;nbsp; FirstYear = $(FirstYear)+1; change this to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;FirstYear = $(FirstYear)+1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Mar 2018 18:47:28 GMT</pubDate>
    <dc:creator>Digvijay_Singh</dc:creator>
    <dc:date>2018-03-12T18:47:28Z</dc:date>
    <item>
      <title>Do While ...Loop continued working after the condition became invalid</title>
      <link>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12288#M607884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I write some code as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set FirstYear=2016;&lt;/P&gt;&lt;P&gt;Let CurrentYear = Year(Today()); //2018&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;DO while $(FirstYear)&amp;nbsp; &amp;lt;= $(CurrentYear)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(vTable)__c_Final:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SQL SELECT&amp;nbsp; *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(vTable)&amp;nbsp; Where CreatedDate&amp;gt;= $(FirstYear)-01-01T00:00:00.000+0000 and CreatedDate&amp;lt;= $(FirstYear)-12-31T00:00:00.000+0000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let&amp;nbsp; FirstYear = $(FirstYear)+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DROP $(vTable)_Final&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SLEEP 1000;&lt;/P&gt;&lt;P&gt;LOOP&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;This code started working and continued working after the condition became invalid! It works with FirstYear = 2016 (true), 2017 (true), 2018(true), 2019 ( false!!) and so on. And when I debug it I don't see "Do.." string in debug cycle. When I write condition in 'LOOP' string, cycle works true:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO...&lt;/P&gt;&lt;P&gt;LOOP&amp;nbsp; while $(FirstYear)&amp;nbsp; &amp;lt;= $(CurrentYear)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;works true.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please tell me why cycle does not&amp;nbsp;&amp;nbsp; work in first case?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2018 13:32:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12288#M607884</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-12T13:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Do While ...Loop continued working after the condition became invalid</title>
      <link>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12289#M607885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not sure but I think you don't need to use &lt;STRONG&gt;'Let' &lt;/STRONG&gt; in below statement as the variable is already defined at the top, looks like its kind of creating FirstYear newly inside the loop - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&amp;nbsp; Let&amp;nbsp; FirstYear = $(FirstYear)+1; change this to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;FirstYear = $(FirstYear)+1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2018 18:47:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12289#M607885</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2018-03-12T18:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Do While ...Loop continued working after the condition became invalid</title>
      <link>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12290#M607886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should not use $() around FirstYear in the Do condition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;DO while FirstYear&amp;nbsp; &amp;lt;= $(CurrentYear)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://masterssummit.com" rel="nofollow" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com" rel="nofollow" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2018 20:06:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12290#M607886</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2018-03-12T20:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Do While ...Loop continued working after the condition became invalid</title>
      <link>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12291#M607887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, I used this code&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;FirstYear = $(FirstYear)+1;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;and had same result.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2018 06:44:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12291#M607887</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-13T06:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Do While ...Loop continued working after the condition became invalid</title>
      <link>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12292#M607888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, you code don't work too &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2018 07:06:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12292#M607888</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-13T07:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Do While ...Loop continued working after the condition became invalid</title>
      <link>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12293#M607889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry!!!!! I hurried.&lt;/P&gt;&lt;P&gt;You where right!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2018 07:09:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/12293#M607889</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-13T07:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Do While ...Loop continued working after the condition became invalid</title>
      <link>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/1758861#M607890</link>
      <description>&lt;P&gt;Hello Rob,&lt;BR /&gt;&lt;BR /&gt;I have a question regarding this very old post.&lt;BR /&gt;&lt;BR /&gt;Today I also found out that using dollar sign expansion does not work in certain cases. See my case below:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Do while ($(#vRefDate) &amp;lt;= $(#vEndDate))
.
.
.
Let vRefDate = AddMonths($(#vRefDate),+1);
Loop&lt;/LI-CODE&gt;&lt;P&gt;This does not work. I have to either move the condition to the end of the loop like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Do
.
.
.
Let vRefDate = AddMonths($(#vRefDate),+1);
Loop while ($(#vRefDate) &amp;lt;= $(#vEndDate))
&lt;/LI-CODE&gt;&lt;P&gt;Or I have to remove the dollar sign expansion from vRefDate variable in the condition like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Do while ((vRefDate) &amp;lt;= $(#vEndDate))
.
.
.
Let vRefDate = AddMonths($(#vRefDate),+1);
Loop&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;But my question is why? What is the cause that the Loop while works with dollar sign exp. and Do while does not? From time to time I am confused by behaviour of dollar sign expansion, which is quite tricky to understand in different use cases.&lt;BR /&gt;&lt;BR /&gt;I only found this&amp;nbsp;&lt;A href="https://support.qlik.com/articles/000073866" target="_blank"&gt;https://support.qlik.com/articles/000073866&lt;/A&gt;&amp;nbsp;article but that does not give me the explanation.&lt;BR /&gt;&lt;BR /&gt;Thanks a lot. Have a great day.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 10:49:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/1758861#M607890</guid>
      <dc:creator>onmysi49</dc:creator>
      <dc:date>2020-11-05T10:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Do While ...Loop continued working after the condition became invalid</title>
      <link>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/2093035#M1224187</link>
      <description>&lt;P&gt;I had the same problem and removed the $() from the second condition as well, like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;do while $(vInRes) &amp;lt; $(vUitRes)&lt;/P&gt;
&lt;P&gt;-&amp;gt;&amp;nbsp; do while vInRes &amp;lt; vUitRes&lt;/P&gt;
&lt;P&gt;and it worked&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 10:32:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-While-Loop-continued-working-after-the-condition-became/m-p/2093035#M1224187</guid>
      <dc:creator>Marius_</dc:creator>
      <dc:date>2023-07-12T10:32:33Z</dc:date>
    </item>
  </channel>
</rss>

