<?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: Incremental Load with time buckets in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Incremental-Load-with-time-buckets/m-p/983265#M946487</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used a BUFFER prefix to the load statement to speed up load time.&amp;nbsp; This however has to be removed when moving to production as I read from Rob's QV CookBook.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would appreciate any other solutions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Dec 2015 00:38:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-12-24T00:38:50Z</dc:date>
    <item>
      <title>Incremental Load with time buckets</title>
      <link>https://community.qlik.com/t5/QlikView/Incremental-Load-with-time-buckets/m-p/983264#M946485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following incremental load Script:&lt;/P&gt;&lt;P&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//Load Incremental Data&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;OLEDB&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;CONNECT32&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;TO&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Provider=SQLNCLI11.1;Persist Security Info=False;User ID=sa;Initial Catalog=PharmaMarketAudit;Data Source=localhost\DATAWAREHOUSE;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=STRATDIGM_1;Initial File Name="";Use Encryption for Data=False;Tag with column collation when possible=False;MARS Connection=False;DataTypeCompatibility=0;Trust Server Certificate=False;Application Intent=READWRITE]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;;&lt;BR /&gt; &lt;BR /&gt; Incremental:&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;LOAD&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Script Number]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Drug Name]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Date&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Floor&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Date Dispensed]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;)) &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Date Dispensed]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Year&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Date Dispensed]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;) * 12 + &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Month&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Date Dispensed]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;) &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;PeriodID&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Time&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Interval&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Date Dispensed]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,'hh:mm:ss'),'hh:mm:ss') &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;TRx_Time_Dispensed&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Script Number]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Previous&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Script Number]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;),'',&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Time&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Interval&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Date Dispensed]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;-&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Previous&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Date Dispensed]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;)),'hh:mm:ss')) &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;TRx_Traffic&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//Time([Date Dispensed],'h tt') &amp;amp; ' - ' &amp;amp; Time([Date Dispensed] + maketime(3,0,0),'h tt') as TimeBucket,&lt;BR /&gt; &lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;DateKey&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//Year([Date Dispensed]) * 100 + Month([Date Dispensed]) + Day([Date Dispensed]) as [DateKey],&lt;BR /&gt; &lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// Directions, &lt;BR /&gt; &lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Repeat or Original]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Doctor Name]&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Prescriber&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;QTY&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;*1 &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;QTY&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[MedAid Amount]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;*1 &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[MedAid Amount]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Shortfall&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;*1 &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Shortfall&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;RangeSum&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[MedAid Amount]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Shortfall]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;)*1 &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Amount&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Med Aid]&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Payment Type]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Supply days]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//[Drug Code]&lt;BR /&gt; &lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Num&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Drug Code]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,'000000') &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Drug Code]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//Num(fabs([Drug Code]),'000000')&amp;nbsp; as [Drug Code],&lt;BR /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Fabs(Num([Drug Code],'000000')) as [Drug Code],&amp;nbsp; &lt;BR /&gt; &lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Num&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Doctor Number]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,'00000') &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Doctor Number]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Upper&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; (&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Retail Pharmacy]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;) &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;RETAILPHARMACY&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Upper&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Branch&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;) &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;BRANCH&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Date&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Date_Modified&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;) &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Date_Modified&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;SQL&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; SELECT Branch,&lt;BR /&gt; DateKey,&lt;BR /&gt; "Date Dispensed",&lt;BR /&gt; "Date_Modified",&lt;BR /&gt; "Doctor Name",&lt;BR /&gt; "Doctor Number",&lt;BR /&gt; "Drug Code",&lt;BR /&gt; "Drug Name",&lt;BR /&gt; "Med Aid",&lt;BR /&gt; "MedAid Amount",&lt;BR /&gt; QTY,&lt;BR /&gt; "Repeat or Original",&lt;BR /&gt; "Retail Pharmacy",&lt;BR /&gt; "Script Number",&lt;BR /&gt; Shortfall,&lt;BR /&gt; "Supply days"&lt;BR /&gt; FROM PharmaMarketAudit.dbo.tblDatawarehouseConsolidatedCleanStage&lt;BR /&gt; WHERE [Date Dispensed] &amp;gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: gray;"&gt;$(vSetLastUpdatedDate)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; and [Date Dispensed] &amp;lt;= '2015-08-31'&lt;BR /&gt; ORDER BY [Retail Pharmacy] asc, [Branch] asc, [Date Dispensed] asc;&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//Concatenate with QVD&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Concatenate&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;LOAD&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Script Number]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Drug Name]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Date Dispensed]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;PeriodID&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;TRx_Time_Dispensed&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;TRx_Traffic&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;DateKey&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Repeat or Original]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Prescriber&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;QTY&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[MedAid Amount]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Shortfall&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Amount&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Payment Type]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Supply days]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Drug Code]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Doctor Number]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;RETAILPHARMACY&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;BRANCH&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Date_Modified&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: gray;"&gt;$(vFolderSourceData)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;\QVDs\PrescriptionHistory.qvd&lt;BR /&gt; (&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;qvd&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//Replace Old QVD file&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;STORE&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; Incremental &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;into&lt;/SPAN&gt; &lt;STRONG&gt;&lt;EM&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: gray;"&gt;$(vFolderSourceData)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;QVDs\&lt;BR /&gt; PrescriptionHistory.qvd (&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;qvd&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;);&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;I then need to construct time buckets from the above as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// Establish sort order for TimeBucket&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;TimeBucketSortTemp:&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;LOAD&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; * &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Inline&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[&lt;BR /&gt; TimeBucket&lt;BR /&gt; 8am-11am&lt;BR /&gt; 11am-2pm&lt;BR /&gt; 2pm-5pm&lt;BR /&gt; 5pm-8pm&lt;BR /&gt; 8pm-8am&lt;BR /&gt; ]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; ;&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// Establish sort order for [Hour Dispensed]&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;HourSortTemp:&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;LOAD&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Time&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;MakeTime&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Hour&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;),'ht') &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Hour Dispensed]&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;INLINE&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[&lt;BR /&gt; Hour&lt;BR /&gt; 7&lt;BR /&gt; 8&lt;BR /&gt; 9&lt;BR /&gt; 10&lt;BR /&gt; 11&lt;BR /&gt; 12&lt;BR /&gt; 13&lt;BR /&gt; 14&lt;BR /&gt; 15&lt;BR /&gt; 16&lt;BR /&gt; 17&lt;BR /&gt; 18&lt;BR /&gt; 19&lt;BR /&gt; 20&lt;BR /&gt; 21&lt;BR /&gt; 22&lt;BR /&gt; 23&lt;BR /&gt; 0&lt;BR /&gt; 1&lt;BR /&gt; 2&lt;BR /&gt; 3&lt;BR /&gt; 4&lt;BR /&gt; 5&lt;BR /&gt; 6&lt;BR /&gt; ]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; ;&lt;BR /&gt; &lt;BR /&gt; TimeBucketMap:&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;MAPPING&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;LOAD&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; * &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;INLINE&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[&lt;BR /&gt; Hour, Bucket&lt;BR /&gt; 0, 8pm-8am&lt;BR /&gt; 1,8pm-8am&lt;BR /&gt; 2,8pm-8am&lt;BR /&gt; 3,8pm-8am&lt;BR /&gt; 4,8pm-8am&lt;BR /&gt; 5,8pm-8am&lt;BR /&gt; 6,8pm-8am&lt;BR /&gt; 7,8pm-8am&lt;BR /&gt; 8,8am-11am&lt;BR /&gt; 9,8am-11am&lt;BR /&gt; 10,8am-11am&lt;BR /&gt; 11,11am-2pm&lt;BR /&gt; 12,11am-2pm&lt;BR /&gt; 13,11am-2pm&lt;BR /&gt; 14,2pm-5pm&lt;BR /&gt; 15,2pm-5pm&lt;BR /&gt; 16,2pm-5pm&lt;BR /&gt; 17,5pm-8pm&lt;BR /&gt; 18,5pm-8pm&lt;BR /&gt; 19,5pm-8pm&lt;BR /&gt; 20,8pm-8am&lt;BR /&gt; 21,8pm-8am&lt;BR /&gt; 22,8pm-8am&lt;BR /&gt; 23,8pm-8am&lt;BR /&gt; ]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; ;&lt;BR /&gt; &lt;BR /&gt; MainData2:&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;LOAD&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; *,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;ApplyMap&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;('TimeBucketMap',&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;hour&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;TRx_Time_Dispensed&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;)) &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;TimeBucket&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; ,&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Time&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;MakeTime&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;hour&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;TRx_Time_Dispensed&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;)),'ht') &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Hour Dispensed]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; ,&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;WeekDay&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Date Dispensed]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;) &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[Weekday Dispensed]&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9pt; font-family: 'Courier New'; color: blue; text-decoration: underline;"&gt;Resident&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt; Incremental&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//Resident [Main Data]&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;DROP&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;TABLE&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; Incremental;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//DROP TABLE [Main Data];&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;STORE&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; [MainData2] &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;into&lt;/SPAN&gt; &lt;STRONG&gt;&lt;EM&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: gray;"&gt;$(vFolderSourceData)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;QVDs\&lt;BR /&gt; PrescriptionHistoryUpdated.qvd (&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;qvd&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;);&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; Using the &lt;SPAN style="color: black; font-size: 9pt; font-family: 'Courier New'; text-decoration: underline;"&gt;&lt;STRONG&gt; [&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9pt; font-family: 'Courier New'; color: blue;"&gt;Resident&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 9pt; font-family: 'Courier New'; text-decoration: underline;"&gt;&lt;STRONG&gt; Incremental] &lt;/STRONG&gt;&lt;/SPAN&gt;data makes the load time high.&amp;nbsp; Is there a way of using the preceding QVD created earlier on: &lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//Replace Old QVD file&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #000000; font-family: 'Courier New'; font-size: 12px;"&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;STORE&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; Incremental &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Courier New'; font-size: 12px;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #000000; font-family: 'Courier New'; font-size: 12px;"&gt;&lt;EM&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: gray;"&gt;$(vFolderSourceData)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;QVDs\&lt;BR /&gt; PrescriptionHistory.qvd (&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;qvd&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;for the resident statement?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Dec 2015 23:37:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Incremental-Load-with-time-buckets/m-p/983264#M946485</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-23T23:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Incremental Load with time buckets</title>
      <link>https://community.qlik.com/t5/QlikView/Incremental-Load-with-time-buckets/m-p/983265#M946487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used a BUFFER prefix to the load statement to speed up load time.&amp;nbsp; This however has to be removed when moving to production as I read from Rob's QV CookBook.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would appreciate any other solutions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2015 00:38:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Incremental-Load-with-time-buckets/m-p/983265#M946487</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-24T00:38:50Z</dc:date>
    </item>
  </channel>
</rss>

