cancel
Showing results for 
Search instead for 
Did you mean: 

How to use character comparaison with IF condition in Formula Mode?

SylvainA
Deputy Chef I
Deputy Chef I

Hello everyone,

With Automation studio, I need to do a character comparaison in Formula Mode.  My currency code in Epicor is CAN but I need to save CAD in currency code of HudSpot.

I need to do something like this:

CurrencyCodeField = "CAN"? "CAD" : "USD"

I tried this but it doesn't work.  

1 ACCEPTED SOLUTION

shivakumara
Executive Chef II
Executive Chef II

Hi @SylvainA ,
Here is solution:

If condition check.PNG
I prefer to add one more condition to have optimize solution to avoid the wrong response
<Input> == "CAN" : "CAD" : <input> == "USD" ? "USD" : "Wrong Input"
More optimized if.PNG

Thanks and Regards,
Shivakumar K A

View solution in original post

7 REPLIES 7

SylvainA
Deputy Chef I
Deputy Chef I

Thank you for your quick answer @shivakumara but ... it still doesn't work.  I tried the easiest way to keep it simple.

<Input> == "CAN" ? "CAD" : "USD"

and I receive this error msg

{"status":"error","message":"Property values were not valid: [{\"isValid\":false,\"message\":\"USD== \\\"CAN\\\" ? \\\"CAD\\\" : \\\"USD\\\" was not one of the allowed options: [label: \\\"CAD\\\"\\nvalue: \\\"CAD\\\"\\ndisplay_order: 0\\nhidden: false\\nread_only: false\\n, label: \\\"USD\\\"\\nvalue: \\\"USD\\\"\\ndisplay_order: 1\\nhidden: false\\nread_only: false\\n, label: \\\"EUR\\\"\\nvalue: \\\"EUR\\\"\\ndisplay_order: 2\\nhidden: false\\nread_only: false\\n]\",\"error\":\"INVALID_OPTION\",\"name\":\"devise___currency\",\"localizedErrorMessage\":\"USD== \\\"CAN\\\" ? \\\"CAD\\\" : \\\"USD\\\" ne faisait pas partie des options autorisées : [label: \\\"CAD\\\"\\nvalue: \\\"CAD\\\"\\ndisplay_order: 0\\nhidden: false\\nread_only: false\\n, label: \\\"USD\\\"\\nvalue: \\\"USD\\\"\\ndisplay_order: 1\\nhidden: false\\nread_only: false\\n, label: \\\"EUR\\\"\\nvalue: \\\"EUR\\\"\\ndisplay_order: 2\\nhidden: false\\nread_only: false\\n]\",\"propertyValue\":\"USD== \\\"CAN\\\" ? \\\"CAD\\\" : \\\"USD\\\"\",\"portalId\":452734}]","correlationId":"0d7d8ca1-1894-4f9f-8b25-25e0bc7924f4","category":"VALIDATION_ERROR"}

 

Hi @SylvainA ,
Could you please include the Workato formula you used so that I can review it? (Include screenshot of your source and formula you have used)

Thanks and Regards,
Shivakumar K A 

HI @shivakumara ,

Sorry, Your answer was correct.  The problem was that I wrote a formula but in a text mode.  I simply switch to formula mode and it was a success.  It's my fisrt formula, I will learn.  🙃  

Regards,

Sylvain