<?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: Load data day by day using loop in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1800209#M1211603</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can prepare a calendar table and then use for each loop.&lt;/P&gt;&lt;P&gt;for each vDate in FieldValueList('yourDateField')&lt;BR /&gt;&amp;nbsp; Data:&lt;BR /&gt;&amp;nbsp; load *; sql statement with sqlDateCol = '$(vDate)';&lt;BR /&gt;next vDate;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Apr 2021 18:56:00 GMT</pubDate>
    <dc:creator>mfchmielowski</dc:creator>
    <dc:date>2021-04-16T18:56:00Z</dc:date>
    <item>
      <title>Load data day by day using loop</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1799763#M1211581</link>
      <description>&lt;P&gt;I have to query data from SQL based system. Due to the limitations and the available bandwidth, I cannot load the entire dataset in one SQL go.&lt;/P&gt;&lt;P&gt;How do I write my SQL query to pull 1 day worth of data and then loop through it until I have all the data till the maximum date?&lt;/P&gt;&lt;P&gt;I have a date field -RecordDate in the data table that I can use to identify the record date.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 14:04:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1799763#M1211581</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2021-04-15T14:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Load data day by day using loop</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1800209#M1211603</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can prepare a calendar table and then use for each loop.&lt;/P&gt;&lt;P&gt;for each vDate in FieldValueList('yourDateField')&lt;BR /&gt;&amp;nbsp; Data:&lt;BR /&gt;&amp;nbsp; load *; sql statement with sqlDateCol = '$(vDate)';&lt;BR /&gt;next vDate;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 18:56:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1800209#M1211603</guid>
      <dc:creator>mfchmielowski</dc:creator>
      <dc:date>2021-04-16T18:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Load data day by day using loop</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1800235#M1211604</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46674"&gt;@mfchmielowski&lt;/a&gt;&amp;nbsp;Thank you. What exactly do you mean by calendar table?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 20:39:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1800235#M1211604</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2021-04-16T20:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Load data day by day using loop</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1800257#M1211607</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/9788"&gt;@qlikwiz123&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Calendar table looks like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;let vMinDate = num(date('2020-01-01', 'YYYY-MM-DD'));
let vMaxDate = num(date('2020-04-01', 'YYYY-MM-DD'));

Calendar:
Load
Date($(vMinDate) + IterNo() - 1) as DateField
AutoGenerate 1
While $(vMinDate) + IterNo() - 1 &amp;lt;= $(vMaxDate);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can declare dates range you want to fetch from sql.&amp;nbsp; And later on as i wrote before the code will look like:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;for each vDate in FieldValueList('DateField')
  Data:
  load *; sql select * from SqlTable where SqlDateCol = '$(vDate)';
next vDate;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have the limitation of bandwidth consider storing results into qvd files and load them insted of sql queries.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Apr 2021 07:57:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1800257#M1211607</guid>
      <dc:creator>mfchmielowski</dc:creator>
      <dc:date>2021-04-17T07:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Load data day by day using loop</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1800584#M1211643</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46674"&gt;@mfchmielowski&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Awesome. Will test this out and let you know how it goes. Thank you so much.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 16:43:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1800584#M1211643</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2021-04-19T16:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Load data day by day using loop</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1800866#M1211667</link>
      <description>&lt;P&gt;Then you can use it like this:&lt;/P&gt;&lt;P&gt;foreach (DateTime day in EachDay(StartDate, EndDate))&lt;BR /&gt;&lt;BR /&gt;In this manner you could hit every other day, every third day, only weekdays, etc. For example, to return every third day starting with the "start" date, you could just call AddDays(3) in the loop instead of AddDays(1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#FFFFFF"&gt;&lt;A href="https://www.myprepaidcenter.bid/" target="_self"&gt;&lt;FONT color="#FFFFFF"&gt;myprepaidcenter&lt;/FONT&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 07:00:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1800866#M1211667</guid>
      <dc:creator>Stewart021</dc:creator>
      <dc:date>2021-04-21T07:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: Load data day by day using loop</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1801931#M1211780</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46674"&gt;@mfchmielowski&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let vMinDate = num(date('2020-01-01', 'YYYY-MM-DD'));&lt;BR /&gt;&lt;FONT color="#993300"&gt;let vMaxDate = num(date('2020-04-01', 'YYYY-MM-DD'));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;How can we make vMaxDate dynamic here so that it takes the maximum date available in the DateField? Also, my DateField is in YYYYMMDD format. If you could help me adjust the same in your expression, it would be really helpful&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 21:13:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1801931#M1211780</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2021-04-22T21:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Load data day by day using loop</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1802184#M1211801</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;Variables vMinDate and vMaxDate you can assing dynamicly. For example&lt;/P&gt;&lt;P&gt;Let vMinDate = num(today() - 7);&lt;/P&gt;&lt;P&gt;Let vMaxDate = num(today());&lt;/P&gt;&lt;P&gt;This is only preparation for calendar. You May also query database for max available date there and use peek function.&lt;/P&gt;&lt;P&gt;Dates:&lt;/P&gt;&lt;P&gt;Load min, max; sql select min(date) as min, max(date) as max From Table;&lt;/P&gt;&lt;P&gt;Let vMinDate=peek('Dates', 0,'min');&lt;/P&gt;&lt;P&gt;Let vMaxDate=peek('Dates', 0,'max');&lt;/P&gt;&lt;P&gt;Drop table Dates;&lt;/P&gt;&lt;P&gt;Create calendar as in previous post but add format.&lt;/P&gt;&lt;P&gt;Date($(vMinDate) + IterNo() - 1, 'YYYYMMDD' ) as DateField&lt;/P&gt;&lt;P&gt;And thats all.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 13:57:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1802184#M1211801</guid>
      <dc:creator>mfchmielowski</dc:creator>
      <dc:date>2021-04-23T13:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Load data day by day using loop</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1802254#M1211808</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46674"&gt;@mfchmielowski&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Awesome. Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see an issue here:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Calendar:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;Load&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;Date($(vMinDate) + IterNo() - 1, 'YYYYMMDD') as DateField&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;AutoGenerate 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;While $(vMinDate) + IterNo() - 1 &amp;lt;= $(vMaxDate);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;In my case, vMinDate is 20210101 and vMaxDate is 20210421. The number of dates between these two is hardly 120 but DateField is giving 321 values, which is way more.&lt;/P&gt;&lt;P&gt;Also, For 'DateField' values, I see below numbers which are neither in YYYYMMDD or Floor. This is causing my loop to work incorrect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="qlikwiz123_0-1619192822060.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/53581i104F1A736ADD96B5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="qlikwiz123_0-1619192822060.png" alt="qlikwiz123_0-1619192822060.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 15:51:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1802254#M1211808</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2021-04-23T15:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Load data day by day using loop</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1802270#M1211809</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/9788"&gt;@qlikwiz123&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Issue is that your dates is not a datetype field but a string type. Before using it to prepare calendar you need to prepare them to be a date. Dates (internaly) are dual or number. Thats why in previous examles i've used num(date(value, format')).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;In that case the valid code will be:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;let vMinDate = num(date#('20210101', 'YYYYMMDD'));
let vMaxDate = num(date#('20210401', 'YYYYMMDD'));

Calendar:
Load
Date($(vMinDate) + IterNo() - 1, 'YYYYMMDD') as DateField
AutoGenerate 1
While $(vMinDate) + IterNo() - 1 &amp;lt;= $(vMaxDate);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;date#() creates datetype value from the input string by designed input format.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mfchmielowski_0-1619194777572.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/53588i7740B886266BAB81/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mfchmielowski_0-1619194777572.png" alt="mfchmielowski_0-1619194777572.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've used yours input dates and that's the result. Hope it helps.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 16:22:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1802270#M1211809</guid>
      <dc:creator>mfchmielowski</dc:creator>
      <dc:date>2021-04-23T16:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Load data day by day using loop</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1802832#M1211849</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46674"&gt;@mfchmielowski&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wonderful. Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 19:17:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-day-by-day-using-loop/m-p/1802832#M1211849</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2021-04-26T19:17:57Z</dc:date>
    </item>
  </channel>
</rss>

