Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello guys,
I have a table that I want to upgrade one of its fields here (COST) :
COST:
load * inline[
ID,COST YEAR
2,20,2014
23,0,2015
];
I have a file that contains the 2016 data , my question is how can i load the table , saying if COST is 0 take COST from file .
field in file:
ID,COST YEAR
23,10,2015
Perhaps something like this:
// Current File
COST:
load * inline
[
ID, COST, YEAR
2,20,2014
23,0,2015
];
//2016 File
Join(COST)
load * inline[
ID, COST As COST1, YEAR
[
23,10,2015
];
// Combine
Result:
Noconcatenate
LOAD ID,
YEAR,
If(COST = 0 Or IsNull(COST), COST1, COST) As COST
Resident COST;
DROP Table COST:
Hi,
1. You need to load both tables into your datamodel. If you load tables in a row they will autoconcatenated (union);
2. Perform resident load from Result table and exclude unnecessary rows using where clause and peek() or previous() functions.
Hope this sheds lights to the solution.
Regards,
Andrei
Perhaps something like this:
// Current File
COST:
load * inline
[
ID, COST, YEAR
2,20,2014
23,0,2015
];
//2016 File
Join(COST)
load * inline[
ID, COST As COST1, YEAR
[
23,10,2015
];
// Combine
Result:
Noconcatenate
LOAD ID,
YEAR,
If(COST = 0 Or IsNull(COST), COST1, COST) As COST
Resident COST;
DROP Table COST:
Thanks a lot