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: 
Anonymous
Not applicable

time stamp driven incremental load

Still new to Qlikview.

I am trying to do some incremental download using QVD and adding more files and store it to a n updated QVD file.

The Data contains time stamp.  So far I have downloaded some QVD files.  Now, I'd like to add some csv files with criteria where the latest time stamp is greater than the latest time stamp in QVD file. What I did was

Incremental_CDR:

LOAD Distinct

   [Time Stamp], B,C,D,E,F,

    

FROM [..\QVD\Filename.qvd] (qvd);

//Last_Record:

LOAD Max (timestamp([Time Stamp])) as Latest_Time_Stamp

Resident Incremental_CDR;

LET $(vLast_Record)= Peek('[Latest_timestamp]', 0, 'Last_Record)');

trace >>> $(vLast_Record);

//Load new Records

concatenate

LOAD Distinct

FROM

$(vSourceData)Filename_*.csv

(txt, codepage is 1252, embedded labels, delimiter is ',', msq)

Where Timestamp([Time Stamp]) > $(vLast_Record);

but it failing with error as follows:

Field not found - <>>

concatenate

LOAD Distinct ...... and rest of the message

When I changed the $(vLast_Record) to a date(e.g. '09/05/2016') it works, but I want to to make it more precise and need to rely on the latest time stamp in last record so that I can append the qvd data and next time do another incremental load will simply use the latest time stamp in the latest qvd file or last record in another source.

Any clue or help?

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

This statement is incorrect:

LET $(vLast_Record)= Peek('[Latest_timestamp]', 0, 'Last_Record)');


It should be:

LET vLast_Record= Peek('[Latest_timestamp]', 0, 'Last_Record)');


no $() on the variable name.


-Rob

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

15 Replies
Gysbert_Wassenaar

LOAD Distinct

FROM

$(vSourceData)Filename_*.csv

(txt, codepage is 1252, embedded labels, delimiter is ',', msq)

Where Timestamp([Time Stamp]) > $(vLast_Record);

You haven't specified any fields to retrieve from the csv file. Perhaps LOAD Distinct * ....etc... does what you want.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Hi,

Actually I did, just forgot to put in the example above. It should be like this

LOAD Distinct

[Time Stamp], B,C,D,E,F,

FROM

$(vSourceData)Filename_*.csv

(txt, codepage is 1252, embedded labels, delimiter is ',', msq)

Where Timestamp([Time Stamp]) > $(vLast_Record);

It keeps showing the same error

Gysbert_Wassenaar

Remove the comma after the F.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Hi, Yes I did. Actually field names are just the examples. No comma after

real filed names.

Also, no value after trace command - trace >>> $(vLast_Update_Record);

On Sat, May 14, 2016 at 7:14 AM, Gysbert Wassenaar <qcwebmaster@qlikview.com

Gysbert_Wassenaar

//Last_Record:

LOAD Max (timestamp([Time Stamp])) as Latest_Time_Stamp

Resident Incremental_CDR;

LET $(vLast_Record)= Peek('[Latest_timestamp]', 0, 'Last_Record)');

Remove the square brackets: Peek('Latest_timestamp', 0, 'Last_Record)');

Remove the ) character after Last_Record: Peek('Latest_timestamp', 0, 'Last_Record');

Use the correct field name: Peek('Latest_Time_Stamp', 0, 'Last_Record');

You might also want to make sure you get a numeric value back: num(Peek('Latest_Time_Stamp', 0, 'Last_Record'));


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

I fixed all syntax but still got the same message.

trace >>> $(vLast_Record);  also did not return any value.  Is there anything missing?


If I changed the condition to certain date it works but I want to make it more autonomous so that I will simply append the data everything I run the script instead of manually change the date or even time.

Any suggestion or help from the experts in this community?

Thanks in advance

Gysbert_Wassenaar

Post an example qlikview document that demonstrates the problem along with two source files that contain at least the timestamp field.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Hi, Please find attached the sample