It would be nice to be able to make a switch/case statement in a recipe. For example, if the transaction type is A, do something, if B, do something else, if C, do another thing, or D do a 4th thing. In coding languages you could do:
switch <datapill>
case A: do something
case B: do something else
case C: do another thing
case D: do a 4th thing
default: say this is an unsupported value right now.
In Workato, this would have to be:
if (datapill = A)
do something
else
if (datapill = B)
do something else
else
if (datapill = C)
do another thing
else
if (datapill = D)
do a 4th thing
This assumes that there's more to do after that. If not then it could just be IF statements, or "stop jobs" could be used to short-circuit the above sooner.
But a case statement seems cleaner to me.
6 people like this idea
D
Darren Stephens
said
over 2 years ago
New to Workato and came looking for this as an alternative to nested if's. Given topic is 2 years old suspect there may be an option for this that I'm not seeing yet.
Mike Power
Case statements
It would be nice to be able to make a switch/case statement in a recipe. For example, if the transaction type is A, do something, if B, do something else, if C, do another thing, or D do a 4th thing. In coding languages you could do:
switch <datapill>
case A: do something
case B: do something else
case C: do another thing
case D: do a 4th thing
default: say this is an unsupported value right now.
In Workato, this would have to be:
if (datapill = A)
do something
else
if (datapill = B)
do something else
else
if (datapill = C)
do another thing
else
if (datapill = D)
do a 4th thing
This assumes that there's more to do after that. If not then it could just be IF statements, or "stop jobs" could be used to short-circuit the above sooner.
But a case statement seems cleaner to me.
6 people like this idea