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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Incremental load

Hi All!

I really need help:

Below code m using for incremental:

LET Starttime =Now();

Max:

LOAD

     Max(CreatedDate) as MaxDate

FROM

F:\Qlikview_Development\BACKUP\Stage1\QVDs\TBL_CURRENTSTOCKUPLOAD_INCR.qvd

(qvd);

Let MaxDate1=TimeStamp(Peek('MaxDate',0,'Max'));

Let MaxTIMESTAMP=Timestamp($(#MaxDate1),'M/DD/YYYY h:mm:ss TT'); //*****  4/12/2012 6:29:30 PM

new_datastock:

LOAD

    DistCode,

     LcnId,

     LcnName,

     PrdId,

     PrdCode,

     PrdName,

     PrdBatId,

     PrdBatchCode,

     PrdBatLcnSih,

     PrdBatLcnUih,

     PrdBatLcnFre,

     PrdBatLcnRessih,

     PrdBatLcnResUih,

     PrdBatLcnResFre,

     UploadedDate,

     CreatedUserID,

     CreatedDate;

SQL SELECT *

FROM NestleConsole.dbo."TBL_CURRENTSTOCKUPLOAD"

WHERE CreatedDate > '$(MaxTIMESTAMP)' ;

But code is picking the the data as if ">="  not ">" MaxTIMESTAMP.

Labels (1)
3 Replies
Not applicable
Author

Hi,

Since you are writing it in SQL select statement then I would suggest you to convert first it to proper date format by using to_date() or to_char() function. (Native date format function in your source DB).

and then pass this variable to this date function which will make the variable value to a proper date.

such as   to_date('070903', 'MMDDYY')

..

Ashutosh

Not applicable
Author

Not working!!!

suniljain
Master
Master

Hii Erica

You can use following logic for increamental load .

Let ThisExecTime = Now( );

QV_Table:

SQL SELECT PrimaryKey, X, Y FROM DB_TABLE

WHERE ModificationTime >= #$(LastExecTime)#

AND ModificationTime < #$(ThisExecTime)#;

Concatenate LOAD PrimaryKey, X, Y FROM File.QVD

WHERE NOT EXISTS(PrimaryKey);

Inner Join SQL SELECT PrimaryKey FROM DB_TABLE;

If ScriptErrorCount = 0 then

STORE QV_Table INTO File.QVD;

Let LastExecTime = ThisExecTime;

End If