Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I'm implementing an incremental load script, that appears to be working fine up to the concatenate step. I however receive an
Failure message:
For some reason it does not appear to find the "store_new" table in I'm using in the last line.
Please find the code here:
Where am I going wrong? Thanks for your help!
Both the [stored new] and the concatenate are being auto concatenated to table1 because they have the same fields as table1. Prevent the auto concatenate using NoConcatenate:
stored_new: NoConcatenate Load ... Concatenate (stored_new) Load ...
Explicitly stating the target of the Concatenate is good practice and may have helped you find the problem quicker.
Posting your code as text rather than as an image makes responding a little easier.
Both the [stored new] and the concatenate are being auto concatenated to table1 because they have the same fields as table1. Prevent the auto concatenate using NoConcatenate:
stored_new: NoConcatenate Load ... Concatenate (stored_new) Load ...
Explicitly stating the target of the Concatenate is good practice and may have helped you find the problem quicker.
Posting your code as text rather than as an image makes responding a little easier.
After your step 2 (creation of QVD)
drop your table 1.
I guess that should be enough in your case.
if you won't drop the table1,the table which you have below are auto concatenate to table1.
so finally,your full table data available in table1 and you are trying to create qvd with stoted_new table.
Thats why it throwing the error as table not found.
Thanks Jontydkpi
The code works fine now, but I just realized that the tables are joined such that the new "incrementally loaded data" (ie. the newest data) is placed at the top of the QVD file and the old data follows below.
IE: if I head a timseries expressed as integers my table would start with 16, 17.....to 25 and AFTER THAT start from 1, 2, ..to 15.
Is there a way so that it saves it in the right order in the qvd?
Please find below the otherwise working code:
// References:
//
// "Macro lib reference:
// LET vFolderPath = 'lib://FilePath/'
// 1 .File load
table1:
LOAD id,
date,
[firsr name],
[second name]
FROM
'lib://Incremental Load/incr1.xlsx'
(ooxml, embedded labels, table is Sheet1);
//2. Create a qvd file.
store table1 into 'lib://QVD/Test.qvd';
drop table table1;
//3. Find current maximum date
max_date:
LOAD
max(date) as Maxdate
FROM 'lib://QVD/Test.qvd'(qvd);
//4. Store the Maximum date in a variable.
Let Maxdate = floor(peek('Maxdate'));
//5.Pull new rows from `incr2.xlsx`.
stored_new:
NoConcatenate
LOAD id,
date,
[firsr name],
[second name]
FROM
[lib://Incremental Load/incr2.xlsx]
(ooxml, embedded labels, table is Sheet1)
where date> $(Maxdate);
STORE stored_new into [lib://QVD/Test.qvd] (qvd);
//6 Concatenate.
Concatenate (stored_new)
LOAD id,
date,
[firsr name],
[second name]
FROM [lib://QVD/Test.qvd] (qvd);
STORE stored_new into [lib://QVD/Test.qvd] (qvd);
Thanks in advance
apologies, there was a mistake in the code I previously posted. Please see here:
// 1 .File load
table1:
LOAD id,
date,
[firsr name],
[second name]
FROM
'lib://Incremental Load/incr1.xlsx'
(ooxml, embedded labels, table is Sheet1);
//2. Create a qvd file.
store table1 into 'lib://QVD/Test.qvd';
drop table table1;
//3. Find current maximum date
max_date:
LOAD
max(date) as Maxdate
FROM 'lib://QVD/Test.qvd'(qvd);
//4. Store the Maximum date in a variable.
Let Maxdate = floor(peek('Maxdate'));
//5.Pull new rows from `incr2.xlsx`.
stored_new:
NoConcatenate
LOAD id,
date,
[firsr name],
[second name]
FROM
[lib://Incremental Load/incr2.xlsx]
(ooxml, embedded labels, table is Sheet1)
where date> $(Maxdate);
//STORE stored_new into [lib://QVD/Testdelta.qvd] (qvd);
//6 Concatenate.
Concatenate (stored_new)
LOAD id,
date,
[firsr name],
[second name]
FROM [lib://QVD/Test.qvd] (qvd);
STORE stored_new into [lib://QVD/Test.qvd] (qvd);
Thanks!