Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to replace the words in the following string with numbers.
Totaling = 'CASH_CARRY|HORECA|KIOSK|OTHER|TRADITION'
Code = CASH_CARRY, HORECA, .....
applymap gives the corresponding numbers for the Code
So I am using
Replace(Totaling,Code,ApplyMap('MAP_Codes', Code)) as ....
but without any success.
any ideas?
Hi,
I'd use a SubStringMap() function along with the MAPPING LOAD you are already using, so:
NumericCodesMap:
MAPPING LOAD Code, Num INLINE [
Code, Num
CASH_CARRY, 1
HORECA, 2
KIOSK, 3
OTHER, 4
TRADITION, 5
];
Data:
LOAD MapSubString('NumericCodesMap', 'CASH_CARRY|HORECA|KIOSK|OTHER|TRADITION') AS Edit
AUTOGENERATE 1;
Hope that helps.
Miguel
Hi,
I'd use a SubStringMap() function along with the MAPPING LOAD you are already using, so:
NumericCodesMap:
MAPPING LOAD Code, Num INLINE [
Code, Num
CASH_CARRY, 1
HORECA, 2
KIOSK, 3
OTHER, 4
TRADITION, 5
];
Data:
LOAD MapSubString('NumericCodesMap', 'CASH_CARRY|HORECA|KIOSK|OTHER|TRADITION') AS Edit
AUTOGENERATE 1;
Hope that helps.
Miguel
You may also try
LOAD
concat(distinct CorrespondingNumbers,'|',index(Totaling,Code)) as TotalingReplacedWithNumbers
RESIDENT YourTable GROUP BY 1;