Incremental Load in Qlik

///$tab Main
SET ThousandSep=’,’;
SET DecimalSep=’.’;
SET MoneyThousandSep=’,’;
SET MoneyDecimalSep=’.’;
SET MoneyFormat=’$#,##0.00;($#,##0.00)’;
SET TimeFormat=’h:mm:ss TT’;
SET DateFormat=’M/D/YYYY’;
SET TimestampFormat=’M/D/YYYY h:mm:ss[.fff] TT’;
SET MonthNames=’Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec’;
SET DayNames=’Mon;Tue;Wed;Thu;Fri;Sat;Sun’;

///$tab First Load
//Let ThisExecTime = Now( );
//
//QV_Table:
//LOAD PrimaryKey,
// X,
// Y,
// Sales,
// ModificationTime
//FROM
//[Incremental Load.xlsx]
//(ooxml, embedded labels, table is DB_TABLE);
//
//STORE QV_Table INTO File.qvd(qvd);
//Let LastExecTime = Now( );
//
//EXIT Script;
///$tab Incremental Load
Let ThisExecTime = Now( );
QV_Table:
LOAD PrimaryKey,X,Y,Sales,ModificationTime
FROM
[Incremental Load.xlsx]
(ooxml, embedded labels, table is DB_TABLE)
WHERE ModificationTime >= ‘$(LastExecTime)’
AND ModificationTime < ‘$(ThisExecTime)’;
CONCATENATE
LOAD PrimaryKey,X,Y,Sales,ModificationTime
FROM
File.qvd(qvd)
WHERE NOT EXISTS(PrimaryKey);
Inner Join
LOAD PrimaryKey
FROM
[Incremental Load.xlsx]
(ooxml, embedded labels, table is DB_TABLE);
If ScriptErrorCount = 0 then
STORE QV_Table INTO File.qvd(qvd);
Let LastExecTime = ThisExecTime;
End If

 

Incremental Load

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.