Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

incremental

OLEDB CONNECT TO [Provider=SQLOLEDB.1;Persist Security Info=False;User ID=qvuser;Initial Catalog=QLKVIEW_SO;Data Source=CLKWQ01;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=CLKWQ01;Use Encryption for Data=False;Tag with column collation when possible=False];

SET vQvdFile='D:\TW Apps\Rough\Data\W6ASSIGNMENTS2.qvd';// The QVD filename

SET vTableName='W6ASSIGNMENTS2';// The name of the QV table we are loading from RawQvd

SET vPK='W6Key';//The primary key field

LET vQvdExists = if(FileSize('$(vQvdFile)') > 0, -1, 0);

IF $(vQvdExists) THEN

       Maxdate:

       LOAD max(TimeModified) as maxloaddate

       FROM $(vQvdFile) (qvd);

      

       LET vIncrementalExpression = 'WHERE [TimeModified] >=' & peek('maxloaddate');

       DROP table Maxdate;

      

ELSE                                    

       LET vIncrementalExpression = '';

      

END IF

W6ASSIGNMENTS2:

SQL SELECT *

FROM "QLKVIEW_SO".dbo.W6ASSIGNMENTS

$(vIncrementalExpression); // WHERE clause condition

IF $(vQvdExists) THEN

CONCATENATE ($(vTableName))

LOAD * FROM $(vQvdFile) (qvd)

WHERE NOT exists($(vPK));

END IF

STORE $(vTableName) INTO $(vQvdFile);

Hi As I written the script above for incremental script for insert and update. I need some help. I used Peek function. That is the only thing not gettig. How it helps here. Wat it returns. I written this by some help but not sure . So can anybody give me idea that how peek function playing a role here.

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Can you post your document log?

-Rob