Written by

Question Tom McDevitt · Jun 6, 2017

Data Transformation Builder Select case statement

Using the Data Transformation Builder I see the action if but in my scenario a case statement  would be better. Is there anyway to do a case statement? This way I dont need to build a long if else logic.

Comments

Marc Mundt · Jun 6, 2017

If you just need to get an output value based on different input values, a lookup table would be the best option.

If you actually need to execute completely different logic depending on the input value, then you can consider using code actions to add a series of ElseIfs, which are much easier to read than deeply nested if blocks.

0
Tom McDevitt · Jun 6, 2017

Thanks, Are you able to have multiple conditions?

if ReceivingFacility="A" or ReceivingFacility="B" or ReceivingFacility="C" {

0
Marc Mundt  Jun 6, 2017 to Tom McDevitt

Yes, you just need to wrap them in parentheses and use "||" for "or":

if ((ReceivingFacility="A") || (ReceivingFacility="B") || (ReceivingFacility="C")) {

Or look at using other functions like $LISTFIND or the "[" (contains) operator:

if ($LISTFIND($LISTBUILD("A","B","C"), ReceivingFacility) {

0