<?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 exit loop in while ....iterno() in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/exit-loop-in-while-iterno/m-p/1334775#M411865</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my load script I have code like this :&lt;/P&gt;&lt;P&gt;Load:&lt;/P&gt;&lt;P&gt;Employee,&lt;/P&gt;&lt;P&gt;Start_date,&lt;/P&gt;&lt;P&gt;addmonths(Monthstart(Startdate),iterno()-1 as month_present&lt;/P&gt;&lt;P&gt;Resident employee_base&lt;/P&gt;&lt;P&gt;while End_date &amp;gt; &lt;SPAN style="font-size: 13.3333px;"&gt;addmonths(Monthstart(Startdate),iterno()-1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Per employee there are multiple records with start_date and end_date&lt;/P&gt;&lt;P&gt;the script runs fine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In some cases in one of these records there is a field named [succes_date] containing a date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I would like to exit the script when the field success_date contains a date &lt;SPAN style="font-size: 13.3333px;"&gt; and some other fields meet certain conditons&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should something be possible like this ?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;while (End_date &amp;gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;addmonths(Monthstart(Startdate),iterno()-1) or&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;((success_date &amp;gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;addmonths(Monthstart(Startdate),iterno()-1) and otherfield1=xxx and otherfield2= xxxx );&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;So far I did not succeed, &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Jun 2017 13:53:08 GMT</pubDate>
    <dc:creator>curiousfellow</dc:creator>
    <dc:date>2017-06-21T13:53:08Z</dc:date>
    <item>
      <title>exit loop in while ....iterno()</title>
      <link>https://community.qlik.com/t5/QlikView/exit-loop-in-while-iterno/m-p/1334775#M411865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my load script I have code like this :&lt;/P&gt;&lt;P&gt;Load:&lt;/P&gt;&lt;P&gt;Employee,&lt;/P&gt;&lt;P&gt;Start_date,&lt;/P&gt;&lt;P&gt;addmonths(Monthstart(Startdate),iterno()-1 as month_present&lt;/P&gt;&lt;P&gt;Resident employee_base&lt;/P&gt;&lt;P&gt;while End_date &amp;gt; &lt;SPAN style="font-size: 13.3333px;"&gt;addmonths(Monthstart(Startdate),iterno()-1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Per employee there are multiple records with start_date and end_date&lt;/P&gt;&lt;P&gt;the script runs fine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In some cases in one of these records there is a field named [succes_date] containing a date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I would like to exit the script when the field success_date contains a date &lt;SPAN style="font-size: 13.3333px;"&gt; and some other fields meet certain conditons&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should something be possible like this ?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;while (End_date &amp;gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;addmonths(Monthstart(Startdate),iterno()-1) or&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;((success_date &amp;gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;addmonths(Monthstart(Startdate),iterno()-1) and otherfield1=xxx and otherfield2= xxxx );&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;So far I did not succeed, &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2017 13:53:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/exit-loop-in-while-iterno/m-p/1334775#M411865</guid>
      <dc:creator>curiousfellow</dc:creator>
      <dc:date>2017-06-21T13:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: exit loop in while ....iterno()</title>
      <link>https://community.qlik.com/t5/QlikView/exit-loop-in-while-iterno/m-p/1334776#M411866</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;If I understood you correctly,&lt;STRONG&gt; While&lt;/STRONG&gt; and &lt;STRONG&gt;IterNo()&lt;/STRONG&gt; you use to read one record several times. To exit the script, you must use the operator&lt;STRONG&gt; Where&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;It should be noted that in one reading cycle of your table you can not apply both operators &lt;STRONG&gt;Where&lt;/STRONG&gt; and &lt;STRONG&gt;While&lt;/STRONG&gt; simultaneously (at least in my practice it was not possible). Therefore, the table should be read twice, approximately as shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RecNo() as ID,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RecNo() as Value&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AutoGenerate 10&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="text-decoration: underline;"&gt;While &lt;/SPAN&gt;IterNo()&amp;lt;=RecNo();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD*&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="text-decoration: underline;"&gt;Where ID&lt;/SPAN&gt; &amp;lt;=5;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table Table1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Andrey&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2017 14:20:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/exit-loop-in-while-iterno/m-p/1334776#M411866</guid>
      <dc:creator>ahaahaaha</dc:creator>
      <dc:date>2017-06-21T14:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: exit loop in while ....iterno()</title>
      <link>https://community.qlik.com/t5/QlikView/exit-loop-in-while-iterno/m-p/1334777#M411867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could try something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while if(len(trim(&lt;SPAN style="font-size: 13.3333px;"&gt;success_date))&amp;gt;0 and &lt;SPAN style="font-size: 13.3333px;"&gt;success_date &amp;lt; &lt;SPAN style="font-size: 13.3333px;"&gt;End_date &lt;SPAN style="font-size: 13.3333px;"&gt;and otherfield1=xxx and otherfield2= xxxx, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&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; &lt;SPAN style="font-size: 13.3333px;"&gt;success_date, &lt;SPAN style="font-size: 13.3333px;"&gt;End_date) &lt;SPAN style="font-size: 13.3333px;"&gt; &amp;gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;addmonths(Monthstart(Startdate),iterno()-1)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;- Marcus&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2017 14:30:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/exit-loop-in-while-iterno/m-p/1334777#M411867</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2017-06-21T14:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: exit loop in while ....iterno()</title>
      <link>https://community.qlik.com/t5/QlikView/exit-loop-in-while-iterno/m-p/1334778#M411868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Marcus, &lt;/P&gt;&lt;P&gt;I tried your solution and it worked. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 08:34:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/exit-loop-in-while-iterno/m-p/1334778#M411868</guid>
      <dc:creator>curiousfellow</dc:creator>
      <dc:date>2017-06-22T08:34:33Z</dc:date>
    </item>
  </channel>
</rss>

