Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys, this is breaking my head, I'm creating an incremental load, but I don't know what's happening, once I concatenate the old data using not exists, the old data is reduced to 1 line per field used in not exist, any clue?
Here's the script
Incremental: |
LOAD *
FROM
[$(FN)](ooxml, embedded labels, table is [$(LastWk)]);
Concatenate
Load * FROM
[$(QVD_Path)\JRZ_RTL_CPC.qvd]
(qvd) where not Exists([PRD Week]);
Before incremental | After incremental |
---|---|
where not Exists([PRD Week]) is behaving correctly. If you pass through a file, it's only going to keep the first occurrence of each [PRD Week] value. After that, the value "exists".
I take it what you want to do is use the set of values for any given week from the excel file, replacing what is in the QVD. Try this:
LOAD *,
[PRD Week] as [PRD Week Update]
FROM
[$(FN)](ooxml, embedded labels, table is [$(LastWk)]);
Concatenate
Load * FROM
[$(QVD_Path)\JRZ_RTL_CPC.qvd] (qvd)
where not Exists([PRD Week Update], [PRD Week]);
DROP FIELD [PRD Week Update];
-Rob
Hi
It looks that the two tables have been joined and this is because the two tables have the same structures. Therefore make a change in one of the tables by adding a new field
load
RecID,
left(RecID,6) as NRecID,
ProdWeek
from
concatenate load
RowID,
ProdWeek
from
where not exists(RecID,NRecID)
Hope this works
try using:
where not Exists(previous table field,current table field)
i.e
where not Exists([PRD Week],[PRD Week])
I tried that already, same results
post some dummy data.
Here are the dummy files, thx for the help
I added a dummy field in the first table, same result
I fixed it... turns out that "not exist" doesn't like integers... I guess this is a bug, here's the code that made it work
Incremental:
LOAD text([PRD Week]) as [PRD Week],
[FGI Week],
CYCLE,
BOL FROM
[LastFile.xlsx]
(ooxml, embedded labels, table is WK33);
Concatenate
LOAD text([PRD Week])as [PRD Week],
[FGI Week],
CYCLE,
BOL
FROM
[JRZ_RTL_CPC.qvd]
(qvd)
where not Exists([PRD Week]);
The solution above was partial it only works the first time I ran it
where not Exists([PRD Week]) is behaving correctly. If you pass through a file, it's only going to keep the first occurrence of each [PRD Week] value. After that, the value "exists".
I take it what you want to do is use the set of values for any given week from the excel file, replacing what is in the QVD. Try this:
LOAD *,
[PRD Week] as [PRD Week Update]
FROM
[$(FN)](ooxml, embedded labels, table is [$(LastWk)]);
Concatenate
Load * FROM
[$(QVD_Path)\JRZ_RTL_CPC.qvd] (qvd)
where not Exists([PRD Week Update], [PRD Week]);
DROP FIELD [PRD Week Update];
-Rob