Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi I have a question about updating qvd data.
First, i've load the data from SourceA,
The data is like this:
Name LastName Qty
A AB 5
I Store that table into Data.QVD
Another week i have another data Source lets say SourceB
The data is like this:
Name LastName Qty
A AB 10
i want to update Data.QVD , so the Qty data will be update from 5 to 10
Is it possible to make it ?
I have try using concatenate, but it keep both data (data with qty 5 and data with qty10)
The result i expect is Data.QVD will have data like this:
Name LastName Qty
A AB 10
Thanks in advance
You'll need some sort of primary key (an id that uniquely identifies each row) and the exists() function to accomplish this. Imagine that Name & LastName can be considered your primary key, then you can go ahead as follows:
NewData: // Load new & updated records
LOAD Name, LastName, Qty, Name & '|' & LastName AS PK
FROM SourceB (options);
CONCATENATE // Add historical records that haven't been updated
LOAD Name, LastName, Qty
FROM SourceA (options)
WHERE Not Exists(PK, Name & '|' & LastName);
DROP Field PK;
This is more or less the basic technique to perform a so-called Incremental Load;
Best,
Peter
You'll need some sort of primary key (an id that uniquely identifies each row) and the exists() function to accomplish this. Imagine that Name & LastName can be considered your primary key, then you can go ahead as follows:
NewData: // Load new & updated records
LOAD Name, LastName, Qty, Name & '|' & LastName AS PK
FROM SourceB (options);
CONCATENATE // Add historical records that haven't been updated
LOAD Name, LastName, Qty
FROM SourceA (options)
WHERE Not Exists(PK, Name & '|' & LastName);
DROP Field PK;
This is more or less the basic technique to perform a so-called Incremental Load;
Best,
Peter
use incremental load
Data:
load * inline [
Name, LastName, Qty
A, AB, 5
];
Store Data into Data.qvd(qvd);
Data:
NoConcatenate
load * inline [
Name, LastName, Qty
A, AB, 10
];
Store Data into Data.qvd(qvd);
Try like this.
I think you need to look at incremental load which allows for deleting and updating records. May be check these links out:
HTH
Best,
Sunny
Hi all,
Thanks for your response.
It solve my problem perfectly.
Thanks in advance
Hi Peter,
Your idea is perfect !
Thanks in advance