Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Hareeshkommineni
Contributor III
Contributor III

Incremental Load Question

While working on incremental load, how can we retrieve the last record 'data' of qvd to insert new data?

3 Replies
groveliam
Creator
Creator

This link should help you: Re: Incremental Load

groveliam
Creator
Creator

Just change max date to whatever you are trying to retrieve.

MarioCenteno
Creator III
Creator III

try

  1. LET vQVDexists = NOT ISNULL(QVDCreateTime('lib://blahblah/v3\ExpediteAuditExtract.qvd'));   
  2. LET vNow = Now(); 
  3. IF $(vQVDexists) THEN; 
  4. TRACE('QVD Exists, so we are going to append'); 
  5.     LatestUpdate:   
  6.     LOAD  Date(Max(updated_dt)) as MaxDate 
  7.     FROM [lib://blahblah/v3\ExpediteAuditExtract.qvd] 
  8.     (qvd) 
  9.     ; 
  10. Trace('Got to the LatestUpdate'); 
  11.      
  12.     LET vMaxDate = Peek('MaxDate',0,'LatestUpdate'); 
  13.     TRACE('Max update' & '$(vMaxDate)'); 
  14.      
  15.     NewData: 
  16.     LOAD * 
  17.     ; 
  18.     SQL SELECT stuff 
  19.     FROM "TableOfInterest" 
  20.     WHERE updated_dt >  '$(vMaxDate)' 
  21.      ; 
  22.  
  23.  
  24. Trace('Concatenating the new data with the old data'); 
  25.     Concatenate(NewData) 
  26.     LOAD * FROM [lib://blahblah/v3\ExpediteAuditExtract.qvd] 
  27.     (qvd) 
  28.     ; 
  29.     STORE NewData into [lib://blahblah/v3\ExpediteAuditExtract.qvd] (qvd); 
  30.     DROP Tables NewData, LatestUpdate 
  31.     ; 
  32.   ELSE 
  33.   Trace('QVD does not exist, so we are doing a full load'); 
  34.     DATA: 
  35.     LOAD everything... 
  36. SQL SELECT everything FROM... 
  37.  
  38.  
  39.     STORE DATA into [lib://blahblah/v3\ExpediteAuditExtract.qvd] (qvd); 
  40.     DROP Table DATA 
  41.     ; 
  42. END IF