Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Friends,
I have the following scenario:
T0:
LOAD * INLINE [
A, B, D
a, b, xyz
a, b, uvw
a, b, rst
]
;
T1:
LOAD * INLINE [
A, B, C
a, b, abcdefg
a, b, abhijk
a, b, ablmno
]
;
I would like to replace dynamically in T1 with the values from T0 based on the couple A|B
My Output would look like:
T2:
LOAD * INLINE [
A,B,C
a, b, xyzcdefg
a, b, xyzhijk
a, b, xyzlmno
a, b, uvwcdefg
a, b, uvwhijk
a, b, uvwlmno
a, b, rstcdefg
a, b, rsthijk
a, b, rstlmno
]
;
I feel the answer to be simple, my brain is slightly tired
Thanks for your help,
Antoine
I didn't noticed that one. Please find the below:
T1:
LOAD A, B, C , A&B AS AB
INLINE [
A, B, C
a, b, abcdefg
a, b, abhijk
a, b, ablmno
]
;
Left Join
LOAD A&B AS AB, D INLINE [
A, B, D
a, b, xyz
a, b, uvw
a, b, rst
];
T2:
NoConcatenate
LOAD *, Replace(C,AB,D) AS NEW_C
Resident T1;
DROP Table T1;
Try MapSubString function like below:
MAP_SS:
MAPPING
LOAD A&B AS AB, D INLINE [
A, B, D
a, b, xyz
a, b, uvw
a, b, rst
]
;
T1:
LOAD A, B, C , MapSubString('MAP_SS',C) AS NEW_C INLINE [
A, B, C
a, b, abcdefg
a, b, abhijk
a, b, ablmno
]
;
Thanks
If you notice, it gives only the first mapped field.
I need it to iterate for all combinations. Any idea how to ?
I didn't noticed that one. Please find the below:
T1:
LOAD A, B, C , A&B AS AB
INLINE [
A, B, C
a, b, abcdefg
a, b, abhijk
a, b, ablmno
]
;
Left Join
LOAD A&B AS AB, D INLINE [
A, B, D
a, b, xyz
a, b, uvw
a, b, rst
];
T2:
NoConcatenate
LOAD *, Replace(C,AB,D) AS NEW_C
Resident T1;
DROP Table T1;
Magic!
Thanks Dathu