Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Apologies for the late reply!
See attached. There were a couple of syntax errors (always end your trace statement with a ; ). I've tested the script by creating a new Report4.xls and changing the date to T+1 and the incremental load worked. Make sure you change your vSourceData and vSaveQVD variables back to your File-Path as I've modifed them in the script.
Let me know if it works okay for you.
I'm missing the following in your code:
Theoretically you should be able to do a final resident loada using a where statement. Something like:
LOAD *
Resident Incremental
WHERE TimeStamp >= '$(vUpdateDate)'
Load the incremental data and store it into a new qvd.
Load the new qvd into a test file and check the data is pulled as per your requirement.
Concatenate the new pulled data into the old qvd.
Hi Martin,
sorry, should be as per below:
Kind Regards,
Olle
// ----QVD LOAD---- //
LOAD
CCY,
ACC,
BIC,
ValueDate,
REF
FROM
$(vSaveQVD)final.qvd
(qvd);
Table2:
LOAD *
Resident Table1
Order By TimeStamp;
LET vUpdateDate = Peek('TimeStamp', -1, 'Table2');
Drop Table Table1;
//---- INCREMENTAL LOAD ----//
Incremental:
NoConcatenate
LOAD CCY,
ACC,
BIC,
ValueDate,
REF
FROM $(vSourceData)*.xls
(biff, embedded labels, header is 3 lines, table is @1)
WHERE Len(currency)=3;
DateTimeInfo:
LOAD
Timestamp#((DATE(@1, 'MM/DD/YYYY')&' '&TIME(@2, 'hh:mm:ss')),'DD/MM/YYYY hh:mm:ss') As TimeStamp
FROM $(vSourceData)*.xls
(biff, no labels, header is 1 lines, table is @1) Where RecNo() < 2;
JOIN(Incremental)
LOAD * RESIDENT DateTimeInfo;
DROP TABLE DateTimeInfo;
//-- UPDATE MAIN QVD --//
Concatenate
LOAD
CCY,
ACC,
BIC,
ValueDate
FROM
$(vSaveQVD)SEBIS.qvd
(qvd)
WHERE NOT Exists(REF);
STORE Incremental into $(vSaveQvd)final.qvd(qvd);
Drop Table Incremental;
First of all be aware of the not exists issue and check if it applies to you.
http://community.qlik.com/docs/DOC-7020
Secondly try adding the following code before updating the main qvd
Final_Incremental
LOAD *
Resident Incremental
WHERE TimeStamp >= '$(vUpdateDate)'
Drop Tables Incremental;
Hi Martin,
thanks for the reading tips! I think the exists function will work in my case.
So I added the "Final_Incremental" table into the Incremental Load section and replaced "Incremental" with "Final_Incremental" in the MAIN QVD UPDATE section. Please see script.
However, receiving below error message:
Table not found
STORE Final_Incremental into final.qvd(qvd)
Any ideas?
Kind Regards,
Olle
//---- INCREMENTAL LOAD ----//
Incremental:
NoConcatenate
LOAD CCY,
ACC,
BIC,
ValueDate,
REF
FROM $(vSourceData)*.xls
(biff, embedded labels, header is 3 lines, table is @1)
WHERE Len(currency)=3;
DateTimeInfo:
LOAD
Timestamp#((DATE(@1, 'MM/DD/YYYY')&' '&TIME(@2, 'hh:mm:ss')),'DD/MM/YYYY hh:mm:ss') As TimeStamp
FROM $(vSourceData)*.xls
(biff, no labels, header is 1 lines, table is @1) Where RecNo() < 2;
JOIN(Incremental)
LOAD * RESIDENT DateTimeInfo;
DROP TABLE DateTimeInfo;
Final_Incremental:
LOAD *
Resident Incremental
WHERE TimeStamp >= '$(vUpdateDate)';
Drop Table Incremental;
//-- UPDATE MAIN QVD --//
Concatenate
LOAD
CCY,
ACC,
BIC,
ValueDate
FROM
$(vSaveQVD)SEBIS.qvd
(qvd)
WHERE NOT Exists(REF);
STORE Final_Incremental into $(vSaveQvd)final.qvd(qvd);
Drop Table Final_Incremental;
Sorry - that's my mystake.
Add a NoConcatenate statement before loading the Final_Incremental table
No more error messages,
however the join does not seem to work (no TimeStamp field in the app) and getting synthetical keys on every field.
A tricky one! ![]()