Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
mwoolf
Not applicable

Re: Peek max date for incremental load

Do I see an apostrophe in front of peek?

jontydkpi
Not applicable

Re: Peek max date for incremental load

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