Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
Recently I've faced a need to map all the possible incoming values to one value. And I failed.
Assume that you have a table of customers and you want to consider just a dozen of them. All the other customers should be renamed as Others, for example.
Is it possible to accomplish this task with mappings? Or is there another nice way except writing complicated conditional load scripts?
I would expect a map like this to work:
mapping load * inline [
x,y
Cust1,Customer 1
Cust2,Customer 2
*,Other customers];
But it doesn't. What would you suggest?
Thanks.
Valera
Valera,
It is simpler than you think:
CustomerMap:
mapping load * inline [
x, y
Cust1,Customer1
Cust2,Customer2];
//
Table:
LOAD
...
applymap('CustomerMap', CustomerCode, 'Other') as Customer,
...
RESIDENT...;
Valera,
It is simpler than you think:
CustomerMap:
mapping load * inline [
x, y
Cust1,Customer1
Cust2,Customer2];
//
Table:
LOAD
...
applymap('CustomerMap', CustomerCode, 'Other') as Customer,
...
RESIDENT...;
Ah, this is the solution! 🙂
However, I was wondering if it was possible to do something the same with "map... using" structure. I am used to it and I wanted to find a solution with "map..using". Can it be done?
Thanks.
Valera
Believe it or not, I've never used "map ... using". The applymap() works fine.