Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Incremental load with Fullaload on every Sunday

Hi,

I need help with incremental load script.

Requirement is to implement incremental load on a daily basis with full loads on every Sunday.

Can someone help me with the script.

Thanks!

6 Replies
Anonymous
Not applicable
Author

If you have not done an Incremental Load before, then you may find this blog post useful.

http://www.quickintelligence.co.uk/qlikview-incremental-load/

maxgro
MVP
MVP

if you search in the QlikView help (look for QVD) you can find "Using QVD Files for incremental load" and copy/adapt some of the logic/code. If you have some problem post your script and the problem here.

Regarding Sunday, you can use an if with

num(WeekDay( Today() ))          --> result is 0, 1, ....6,  0 on Monday

to switch from incremental to full .

Anonymous
Not applicable
Author

I see people are using peek function in incremental loads, can someone please explain me why?

Anonymous
Not applicable
Author

I would guess to find the record with the latest date to then load records later than this date.

Anonymous
Not applicable
Author

could you please draft that into a script for me? Thanks!

stabben23
Partner - Master
Partner - Master

Hi, something like this:

LET vExecTime = timestamp(vnow, 'YYYYMMDD'); //hh:mm:ss:
SET vLastExecTime= 0; // resetting vLastExecTime

if not isnull(QVDCreateTime('$(QVDPath)MainTable.qvd')) then
LoadTime:
load Maxstring(timeStmp) as X

from $(QVDPath)MainTable.qvd (qvd);

Let vLastExecTime =peek('X',0,'LoadTime');
Drop Table LoadTime;
end if

MainTable:

LOAD
*,
KEY as %key
;

SQL SELECT *
FROM Table
WHERE timeStmp >= '$(vLastExecTime)' and timeStmp <= '$(vExecTime)'  
;

//Check to see if this is the first reload. If it is, skip this step
if Not isnull(QvdCreateTime('$(QVDPath)MainTable.qvd')) then
Concatenate (MainTable)
LOAD *
FROM $(QVDPath)MainTable.qvd (qvd)
Where not (Exists(%key));
end if

//Check to see if there is deleted rows, and full reload
if(WeekDay(today())='sun') then
inner join
Load *, KEY as %key;
SQL SELECT *, KEY
FROM Table
;
end if

//If data exists within table, store to QVD.
if NoOfRows('MainTable') > 0 then
STORE MainTable INTO $(QVDPath)MainTable.qvd (qvd);
Drop Table MainTable;
end if

;