Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Peek max date for incremental load

Hi,

im trying to start an incremental load based in timestamps.

BUT the creation of a variable with which i want to limit the load does not work.

let vMAXTIMEms= 'peek(time_mill,-1,data_table) ;

seems to be completely ignored by the qlikview script (no syntax error on that line).
at the line where the variable should be used, i get an error. what is wrong ? Maybe some problems with peek and the variable ?

Any ideas ?

The table looks like this

data_table:

LOAD

    source_ID,

    source_TYPE,

    time_RES,

    time,

    time_mill,

    UNIT,

    VALUE

FROM ./QV_VALUES.qvd

WHERE time_RES = 'DAY'

AND   source_TYPE = 'A'

;   

The plan is to follow these steps in the script
1. load the old data from qvd to get the date of the last entry. To speed this up, only the timestamp field is loaded

data_table:

LOAD

    time_mill

FROM ./QV_VALUES.qvd

WHERE time_RES = 'DAY'

AND   source_TYPE = 'A'

;   

2. write the max(timestamp) in a Variable vMAX_mill

let vMAXTIMEms= 'peek(time_mill,-1,data_table) ;

3. use $(vMAXTIMEms)>=time_mill
in the incremental part of the loadscript

2 Replies
m_woolf
Master II
Master II

Do I see an apostrophe in front of peek?

jonathandienst
Partner - Champion III
Partner - Champion III

Agreed - there should be no apostrophe there, but there should be quotes here:

Let vMAXTIMEms = Num(peek('time_mill',-1,'data_table'));


This assumes that the qvd load is sorted by time_mill. i would also ensure that it is a number with Num(). Otherwise you should do this:


temp:

LOAD max(time_mill) As maxTime

From .... (qvd);  // or resident....

Let vMAXTIMEms = Num(peek('maxTime'));

DROP Table temp;




Logic will get you from a to b. Imagination will take you everywhere. - A Einstein