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

Announcements
Week 2: Presenting "Automate Sucess" and "Integration for Innovation" - WATCH NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Incremental Load question

I have an incremental load with the variable 'vLastLoadDate'.  This is to be used to pull records that have been added/changed since the last time they were loaded.  Once the load is completed I update the vLastLoadDate with today's date.  However, I am not sure how to initialize the vLastLoadDate to do the very first load without it resetting to the initialized date each time I reload the document.

5 Replies
cfz
Former Employee
Former Employee

Hi Alexander,

Once you do the very first reload you should uncomment the line with the initialization of the variable (in fact I don't think the variable is needed at all for the very first reload since I assume you would like to load all the data available.

I hope it helps.

Carlos

maxgro
MVP
MVP

store in a file (qvd)

when there is the file load the vLastLoadDate from the file

when the file is missing, use an old date

at the end of the load, when ok, store vLastLoadDate in the file

if you want to reinitialize the process, delete the file and reload

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Simple: Do not create/initialize this vLastLoadDate variable at the beginning of your script, but create/set its initial value in Settings->Variable Overview...  This kind of variable gets its initial value only once: the moment you create it. It then keeps that value across Reloads (unless you use a LET/SET statement somwhere in your script.)

Of course, at the end of your script, you should still update its value to the current date. The value stays like that until it is adjusted again at the end of the next Reload.

Not applicable
Author

Do you mean the variable table? If so, that is super easy!

Alex

Sent from my iPhone

Peter_Cammaert
Partner - Champion III
Partner - Champion III

I don't know what you mean exactly by "Variable table". Just to be sure:

Yes, it is super simple. Launch QlikView Desktop, open your document, from the menu select Settings->Variable Overview... and (if it's not already there) add a new variable called 'vLastLoadDate' and set its initial value to something like 1/1/1990 or some other date before the earliest date in your data.

Now remove any SET/LET statement from the start of your script that initializes this same variable. Leave the SET/LET statement(s) at the end in place. They will update the value upon loading the first set of records which will probably be the entire table. This value will become for example 13/5/2014.

The next reload will start with vLastLoadDate = 13/5/2014 as this value was stored with the rest of the data at the end of the first reload.

And so on.

Good luck,

Peter