<?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: Using FOR to double records within a range of weeks in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059343#M354836</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rudy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your post. You can mark a reply as Correct by clicking the "Correct Answer" button at the bottom of the reply (with the green star). For more details, see: &lt;A href="https://community.qlik.com/docs/DOC-14806"&gt;Qlik Community Tip: Marking Replies as Correct or Helpful&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Qlik Community Moderation Team&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Mar 2016 18:58:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-03-08T18:58:32Z</dc:date>
    <item>
      <title>Using FOR to double records within a range of weeks</title>
      <link>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059335#M354828</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;I need to split up records (make doubles but with different week indication) into several records by week within a range of weeks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First I make records from first start week and then add the records for the following weeks if needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Starting set of records:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-7" src="https://community.qlik.com/legacyfs/online/116418_pastedImage_7.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;Records that have to be split up:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-6" src="https://community.qlik.com/legacyfs/online/116412_pastedImage_6.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;End result:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-5 jive-image" src="https://community.qlik.com/legacyfs/online/116407_pastedImage_5.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;I am using For statement with dates.&lt;/P&gt;&lt;P&gt;But I don't get the expressions correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;FOR vWeek = $(vWeekFromRow) to $(vWeekTillRow) step 7&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get errors like &lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-4" src="https://community.qlik.com/legacyfs/online/116406_pastedImage_4.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the attached Tasks.qvw file for details&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RW&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Mar 2016 11:01:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059335#M354828</guid>
      <dc:creator>rudywelvaert</dc:creator>
      <dc:date>2016-03-01T11:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using FOR to double records within a range of weeks</title>
      <link>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059336#M354829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Line 64 and 65 in your Load Script assigns dates to the two variables. In line 67 when you do a $-sign expansion - that is not necessary. It will actually not recognize this as dates but as a division and thus make a small number which is a real - which again isn't good for a FOR NEXT loop...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Running your Load Script with the Debugger will reveal what I just said:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2016-03-01 #1.PNG" class="jive-image image-1" src="/legacyfs/online/116423_2016-03-01 #1.PNG" style="height: 336px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STEPPING FURTHER:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2016-03-01 #2.PNG" class="jive-image image-2" src="/legacyfs/online/116424_2016-03-01 #2.PNG" style="height: 288px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lastly I think in general that nested&amp;nbsp; FOR NEXT loops here might be very inefficient compared to doing a WHILE in your loop and possibly using preceding loads too.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Mar 2016 11:19:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059336#M354829</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2016-03-01T11:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using FOR to double records within a range of weeks</title>
      <link>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059337#M354830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Petter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to change the code using a While in stead of a For with two extra variables vWeek and vWeekTill&lt;/P&gt;&lt;P&gt;Also needed to change the Where statement: Where TEMP_TASKS_2_ID = $(vRowNo);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/116446_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;Now I get this result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="116444" alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/116444_pastedImage_6.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;in stead of&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="116445" alt="" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/116445_pastedImage_7.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks as if the loop variables vWeek and vWeekTill are not evaluated on the right moment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RW&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Mar 2016 13:56:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059337#M354830</guid>
      <dc:creator>rudywelvaert</dc:creator>
      <dc:date>2016-03-01T13:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using FOR to double records within a range of weeks</title>
      <link>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059338#M354831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry ... I wasn't clear enough. I should have said the WHILE clause that is part of the LOAD statement. It is much more efficient in iterating through rows/records - but it pose more challenging. I think I will have a closer look at it in a couple of hours to give you more detailed suggestions and give you some pointers on how to use it...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Mar 2016 17:28:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059338#M354831</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2016-03-01T17:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using FOR to double records within a range of weeks</title>
      <link>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059339#M354832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is how you could use the LOAD .... WHILE logic - which is more straightforward:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2016-03-01 #3.PNG" class="jive-image image-1" src="/legacyfs/online/116488_2016-03-01 #3.PNG" style="height: 494px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The WHILE makes the LOAD iterate over each row while the condition in the WHILE part is satisfied. You will often use the IterNo() function that gives you the number of the iteration it is currently in for the given row to get the right number of iterations. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this LOAD the number of iterations that has to be taken for each row will be satisfied by either:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;STATUS = 'OPEN' AND IterNo() &amp;lt;="&lt;SPAN style="font-size: 13.3333px; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;STRONG&gt;TheNumberOfWeeksBetween_WEEK_TILL_AND_WEEK_FROM"&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;EM&gt;"&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;EM&gt;TheNumberOfWeeksBetween_WEEK_TILL_AND_WEEK_FROM" calculated like this:&amp;nbsp; Floor((WEEK_TILL-WEEK_FROM)/7)+1&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;OR&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; STATUS = 'CLOSED' AND IterNo() = 1&lt;/STRONG&gt;&amp;nbsp; ( We should include every CLOSED status but not iterate further)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Mar 2016 18:36:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059339#M354832</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2016-03-01T18:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Using FOR to double records within a range of weeks</title>
      <link>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059340#M354833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Petter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this helped me a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RW&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2016 09:51:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059340#M354833</guid>
      <dc:creator>rudywelvaert</dc:creator>
      <dc:date>2016-03-08T09:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using FOR to double records within a range of weeks</title>
      <link>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059341#M354834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you considered this as final please mark the question as answered &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2016 12:05:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059341#M354834</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2016-03-08T12:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using FOR to double records within a range of weeks</title>
      <link>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059342#M354835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Petter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to, but when I click actions I get this:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/117336_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;I only can indicate if it were Helpfull&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/117340_pastedImage_3.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I can Like it&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-2" height="170" src="https://community.qlik.com/legacyfs/online/117339_pastedImage_2.png" style="width: auto; height: auto;" width="155" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RW&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2016 12:17:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059342#M354835</guid>
      <dc:creator>rudywelvaert</dc:creator>
      <dc:date>2016-03-08T12:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using FOR to double records within a range of weeks</title>
      <link>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059343#M354836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rudy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your post. You can mark a reply as Correct by clicking the "Correct Answer" button at the bottom of the reply (with the green star). For more details, see: &lt;A href="https://community.qlik.com/docs/DOC-14806"&gt;Qlik Community Tip: Marking Replies as Correct or Helpful&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Qlik Community Moderation Team&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2016 18:58:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-FOR-to-double-records-within-a-range-of-weeks/m-p/1059343#M354836</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-08T18:58:32Z</dc:date>
    </item>
  </channel>
</rss>

