Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi I have script like after resident load 2 table
Table1:
LOAD Country,
Branch,
sales
Week,
month,
Year
Resident tab:
Table2:
LOAD Country,
Branch,
Week,
month,
Year
Resident tab2:
Here i need do left join to Table1 and If Country and Branch and Week and Month and Year not matched with Table1 then i need to show for sales as 0 otherwise 1.Could you please help on Script part because i not able put condition for sales due to resident load.
Thanks,
Rajesh
Hi Rajesh,
instead of left join use applymap.
Table2:
Mapping LOAD
Country& Branch & Week & month & Year as %MapKey,
'1' as mapvalue
Resident tab2;
Table1:
LOAD Country,
Branch,
sales,
applymap('Table2',Country& Branch & Week & month & Year,0) as salesFlag,
Week,
month,
Year
Resident tab;
Hi Rajesh,
instead of left join use applymap.
Table2:
Mapping LOAD
Country& Branch & Week & month & Year as %MapKey,
'1' as mapvalue
Resident tab2;
Table1:
LOAD Country,
Branch,
sales,
applymap('Table2',Country& Branch & Week & month & Year,0) as salesFlag,
Week,
month,
Year
Resident tab;
Thanks for revert back Staffan..Can i defined in resident load for Key like without defining columns,
Table2:
Mapping LOAD
Country& Branch & Week & month & Year as %MapKey,
'1' as mapvalue
Resident tab2;
In above code Country& Branch & Week & month & Year as %MapKey, can we define because first we need to include those columns in LOad it self .
Thanks,
Rajesh
Resident for Applymap should work.
If you have the key from tab2 you just use it.
tab2:
Load
Country& Branch & Week & month & Year as %MapKey,
..
...
..
from ........
mapping Load
%MapKey
'1' as mapvalue
Resident tab2;
Yes that's fine but when ever you defining %MapKey, value in any load first you need to keep the columns and create %MapKey,.Here key created directly with out colums for the frist time .
In case you're using Applymap and loading data as Resident you need to have the columns from which you creating the %MapKey or else already have created the %MapKey as stabben23 suggested.
Thanks Staffan it's working fine