Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All.
Really hope you could help me with the following issue.
In our script we use 'set' in order to translate some of the fields.
SET translated_make = "if(Upper($1)='SM','Samasung',$1)";
SET translated_model = "if(Upper($1)='LOCAL','PC Local',$1)";
and when we are loading the fields we are using the following functions:
Devices:
load
$(translated_make(device_make)) as Devices_device_make,
$(translated_model(device_model)) as Devices_device_model
my problem is that one of the translated names should be depends on both make&model.
let say if device_make=Nk and device_mode=953 then I want to 'set translated make to null value' and also to 'set translated model to a null value'.
the different now is that I have a if condition with 'and' operator.
Hope I was clear enough. can someone please advise?
thanks!
Yes
If(Not(device_make=Nk and device_mode=953),$(translated_make(device_make))) -- If device_make is not equal to Nk and device_mode is not equal to 953, then this expr return $(translated_make(device_make)) else return null
Devices:
load
If(Not(device_make=Nk and device_mode=953),$(translated_make(device_make))) as Devices_device_make,
If(Not(device_make=Nk and device_mode=953),$(translated_model(device_model))) as Devices_device_model
load
...
if(len(device_make)>0 and len(device_model)>0, $(translated_make(device_make)), Null()) as Devices_device_make,
if(len(device_make)>0 and len(device_model)>0, $(translated_model(device_model)), Null()) as Devices_device_model
...
Often suited a mapping with applymap() such translations better - especially if there are more than a few items.
- Marcus
Hi thank you for answering!
But how can I change the 'NK' value and the '953' Value to null? will it be null automatically after using your condition?
hi thanks for answering
but where did you refer to the values of the device_make and device_model?
Yes
If(Not(device_make=Nk and device_mode=953),$(translated_make(device_make))) -- If device_make is not equal to Nk and device_mode is not equal to 953, then this expr return $(translated_make(device_make)) else return null
Thank you!!!!! you really helped me