Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have an indicator field IND with values 'Y' and 'N' . Would like to know, how to apply dual on this field in the load script, then Y would be displayed first.
Is this what you are looking for?
dual(FlagText, pick(match(FlagText, 'Y','N'), 1, 2)) as Flag
Is this what you are looking for?
dual(FlagText, pick(match(FlagText, 'Y','N'), 1, 2)) as Flag
The solution by @stevejoyce will do the trick.
An alternative solution is to use a mapping table in combination applymap() or MAP ... USING ... in the case where I have several fields that I need to map.
MAP_YES_NO:
MAPPING LOAD
TXT,
dual(TXT, NUM) as DUAL
INLINE [
TXT, NUM
Y, -1
N, 0
];
MAP IND, EVEN, ODD USING MAP_YES_NO;
TABLE:
LOAD
ID, //applymap('MAP_YES_NO', ID) as ID
PRIME,//applymap('MAP_YES_NO', PRIME) as PRIME
EVEN, //applymap('MAP_YES_NO', EVEN) as EVEN
ODD //applymap('MAP_YES_NO', ODD) as ODD
Inline [
ID,PRIME,EVEN,ODD
1, Y, N, Y
2, Y, Y, N
3, Y, N, Y
4, N, Y, N
5, Y, N, Y
6, N, Y, N
7, Y, N, Y
];