How do I perform if_else_if logic in Upsolver
I have a field with values such as android, amazon, iphone, now i want to create a column based on this calculated field. For example, type.
Here's another example: when the calculated field is “android” for a record then type column should have “google” as value for that record
-
Official comment
So there are actually 2 options to perform what you are trying to do:
First option is with the REGEX NAMED GROUPS function. This will create a field with AndroidPhone, IPhone, IPad, etc.
Afterwards you can use the TRANSLATE function where you can create a dictionary based on that field.
So if you get the key 'IPhone' it will output 'Apple'.
Second option is indeed to use the Case When function.
The syntax goes something like:
Set TYPE = CASE WHEN CONTAINS ('android', uid) THEN 'google' WHEN CONTAINS ('iphone', uid) THEN 'apple'....
Please sign in to leave a comment.
Comments
1 comment