Nested IF with calculated return value

Hello Everyone,
I am facing issues to return calculated value using if statement.
Can someone suggest the possible nodes to solve this?

DataSet
Col1: Location Currency
EUR
EUR
USD

Col2: Invoice Currency
EUR
USD
INR

Output column
Blank
USD/EUR
USD/INR

Logic:
IF (Location Currency = Invoice Currency)
Return Blank
If (Location Currency = “EUR”)
Return Invoice Currency / Location Currency
else
Return Location Currency / Invoice Currency

Thank You

I assume you have actual int or floats somewhere in the table to the mathematical operation. Or are you in fact dividing strings? If you provided some sample data structured like your table I could probably solve this for you!

1 Like

The data set also contains string as shown in the example.

Your issue is a bit tricky because you want to output a string with the symbol of division, which is not capable with strings. I wrote you a workflow that solves this issue, however, using some if/else logic and string manipulation.

image

Nested IF with calculated return value.knwf (47.4 KB)

Hope this helps, my friend!

3 Likes

This works perfect!!!
Thanks for the help…

Hi there,

I would go with scripting in this case to have it all in one node. So either Java, Python, Column Expressions

Here is solution with last option mentioned.
Nested IF with calculated return value_ipazin.knwf (25.4 KB)

Br,
Ivan

4 Likes

Cool! I was unfamiliar with the Column Expressions node. I will play around with this!

1 Like

This is really cool. Thank you!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.