<?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...next with unknown boundry(s) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251446#M707130</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Miguel, pasting a mockup of my script to explain a bit more.&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;for vWeek= 1 to 52&lt;BR /&gt;for vTrans=1 to 500&lt;/P&gt;&lt;P&gt;LOAD colT1,&lt;BR /&gt;&amp;nbsp; colT2&lt;BR /&gt;FROM&lt;BR /&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://yourdomain.com/history/weeks.asp?qsWeek=$(vWeek)&amp;amp;trans=$(vTrans"&gt;http://yourdomain.com/history/weeks.asp?qsWeek=$(vWeek)&amp;amp;trans=$(vTrans&lt;/A&gt;&lt;SPAN&gt;)]&lt;/SPAN&gt;&lt;BR /&gt;(html, codepage is 1252, embedded labels, table is @2);&lt;/P&gt;&lt;P&gt;next&lt;BR /&gt;next&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I don't know how many trans there are. It could be 2 or 234 or 478. Lets say that it is 234 -when the for loop reaches 235 and tries to load that, an error occures because there are no such url. When that happens I would like to loop to 500 (without errors and no saving (loading) so that we loop vWeek and start all over again.&lt;/P&gt;&lt;P&gt;Even more complicated since they use leading zeros so trans #1 is really 001 and so on. Sorted that out with if..elseif..else but it's a lot of nestling.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Nov 2011 14:41:14 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-11-23T14:41:14Z</dc:date>
    <item>
      <title>for...next with unknown boundry(s)</title>
      <link>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251444#M707128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Continuing explore for...next and stumbeld upon another issue. What if I don't know my for boundries? The max value could be 216 or 345 or 555. Is&amp;nbsp; it possible to set for i = 1 to 1000 and then handle the error in the script? Actually ignore error and LOAD nothing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2011 13:54:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251444#M707128</guid>
      <dc:creator />
      <dc:date>2011-11-23T13:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: for...next with unknown boundry(s)</title>
      <link>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251445#M707129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thomas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What about using EXIT FOR?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;FOR i = 1 TO 2000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD $(i) AS Field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AUTOGENERATE 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET vMaxValue = Peek('Field', -1, 'Table');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EXIT FOR WHEN $(vMaxValue) &amp;gt;= 100;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NEXT&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is pretty dummy, but you can get the idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/people/mabaeyens" style="outline-style: none; padding-top: 1px; padding-bottom: 1px; padding-left: 17px; color: #007fc0; zoom: 1; background-position: no-repeat no-repeat;"&gt;Miguel Angel Baeyens&lt;/A&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;BI Consultant&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;&lt;A class="jive-link-external-small" href="http://www.grupocomex.com/" style="outline-style: none; color: #007fc0;"&gt;Comex Grupo Ibérica&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2011 14:05:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251445#M707129</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-11-23T14:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: for...next with unknown boundry(s)</title>
      <link>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251446#M707130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Miguel, pasting a mockup of my script to explain a bit more.&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;for vWeek= 1 to 52&lt;BR /&gt;for vTrans=1 to 500&lt;/P&gt;&lt;P&gt;LOAD colT1,&lt;BR /&gt;&amp;nbsp; colT2&lt;BR /&gt;FROM&lt;BR /&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://yourdomain.com/history/weeks.asp?qsWeek=$(vWeek)&amp;amp;trans=$(vTrans"&gt;http://yourdomain.com/history/weeks.asp?qsWeek=$(vWeek)&amp;amp;trans=$(vTrans&lt;/A&gt;&lt;SPAN&gt;)]&lt;/SPAN&gt;&lt;BR /&gt;(html, codepage is 1252, embedded labels, table is @2);&lt;/P&gt;&lt;P&gt;next&lt;BR /&gt;next&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I don't know how many trans there are. It could be 2 or 234 or 478. Lets say that it is 234 -when the for loop reaches 235 and tries to load that, an error occures because there are no such url. When that happens I would like to loop to 500 (without errors and no saving (loading) so that we loop vWeek and start all over again.&lt;/P&gt;&lt;P&gt;Even more complicated since they use leading zeros so trans #1 is really 001 and so on. Sorted that out with if..elseif..else but it's a lot of nestling.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2011 14:41:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251446#M707130</guid>
      <dc:creator />
      <dc:date>2011-11-23T14:41:14Z</dc:date>
    </item>
    <item>
      <title>for...next with unknown boundry(s)</title>
      <link>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251447#M707131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thomas, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;maybe you could use ScriptError and errormode together with proposed Exit for?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;set ErrorMode=0;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // will prevent from stopping script in case of error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class="jive-code"&gt;for vWeek= 1 to 52&lt;BR /&gt;for vTrans=1 to 500&lt;BR /&gt;LOAD colT1,&lt;BR /&gt;&amp;nbsp; colT2&lt;BR /&gt;FROM&lt;BR /&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://yourdomain.com/history/weeks.asp?qsWeek=$(vWeek)&amp;amp;trans=$(vTrans"&gt;http://yourdomain.com/history/weeks.asp?qsWeek=$(vWeek)&amp;amp;trans=$(vTrans&lt;/A&gt;&lt;SPAN&gt;)]&lt;/SPAN&gt;&lt;BR /&gt;(html, codepage is 1252, embedded labels, t&lt;/CODE&gt;&lt;CODE class="jive-code"&gt;able is @2);&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;exit for when &lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;ScriptError &amp;lt;&amp;gt;1&lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;;&lt;/SPAN&gt; &lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class="jive-code"&gt;next&lt;BR /&gt;next&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2011 14:53:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251447#M707131</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-11-23T14:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: for...next with unknown boundry(s)</title>
      <link>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251448#M707132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a similar issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm reading a table where I can only pull 50k records at a time due to the limitations of an ODBC driver with a cloud based application.&amp;nbsp; Right now I am counting the number of records so I know how many times to perform the loop.&amp;nbsp; My issue is the simple count of records is taking a very long time (SELECT COUNT(*) FROM TABLE).&amp;nbsp; I want to eliminate that step and just run the loop and have it stop when all the records have been read. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would I do that?&amp;nbsp; It seems so simple but I can't find the solution.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 21:16:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251448#M707132</guid>
      <dc:creator>phcaptjim</dc:creator>
      <dc:date>2015-01-09T21:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: for...next with unknown boundry(s)</title>
      <link>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251449#M707133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could consider if incremental loads are possible - &lt;A href="https://community.qlik.com/docs/DOC-4597"&gt;Incremental Load&lt;/A&gt;. If not you could look to a record-id from this table - maybe through meta-data from system-tables from these database. Also could a split from this task into two tasks help to improve your load-times. Then the first step to generate only the record-count could run before and parallel to other tasks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Jan 2015 17:43:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/for-next-with-unknown-boundry-s/m-p/251449#M707133</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-01-10T17:43:37Z</dc:date>
    </item>
  </channel>
</rss>

