Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I would like to map 3 unrelated field values to a new field.
In more detail:
I have the fields:
1) WebSite
2) Language
3) CustomersCountry
I want to create a new field based on the values of these fields. The following table has an example logic:
WebSite | Language | CustomersCountry | NewField |
---|---|---|---|
site1.ru | (any value) | (any value) | Russia |
site2.ru | (any value) | (any value) | Bulgaria |
site3.ru | (any value) | (any value) | Ukraine |
anothersite.ro | (any value) | (any value) | Romania |
home24.com | Russia | (any value) | Russia |
home24.com | Romania | (any value) | Romania |
home24.com | Bulgaria | (any value) | Bulgaria |
travel.gr | (any value) | Cyprus | Cyprus |
travel.gr | (any value) | Greece | Greece |
'
e.t.c.
What is the best way to do that?
Thanks in advance
Panayotis
Hi, can you explain how you map for example the first row to "Russia"?
Exactly as the table example given above.
> When "WebSite" is "site1.ru" and for any value of "Language" and for any value of "CustomersCountry" field "NewField" has to have the value "Russia".
Hi
Just use a composite key (concatenation of website, language, customer country and map that to NewField.
mapfield:
mapping load
Website & Language & CustomerCountry,
NewField
FROM ....;
Then use apply map like:
LOAD ...
...
applymap('mapfield', Website & Language & CustomerCountry) As NewField
...
FROM ...
You could also use a join rather than a map for this sort of issue.
Hope that helps
Jonathan