How to use ternary operator

Hi All,

Did any one came across, how to use the ternary operator in web methods at any point …??

Thanks and Regards,
Punith Reddy.T

You’re going to need to be a little more specific.

Probably use it in a Java service with input variables and use that as a re-usable service whenever required.

HTH
~P

Hi

Here is the scenario.
i need to build some common utility/use existing utility for the ternary operator functionality like
(condition)?true:false and everything like condition,values has to be dynamic

For example
(10>4)?1:0 i.e
if value 10 is greater than 4, then provide the output as 1.
else output as o.

And my guess is, we can use branch step evaluate labels to true or we can use map evaluate copy condition.

But in both these cases, we need to pass the condition dynamically to properties tab of branch/map.
(Please find the attachment screenshot)

Please not that, i’m able to design this functionality as shown in screenshot.
But i feel, my code is restricting the usage as i need to modify every time when ever a new condition is needed like addition/subtraction etc.

Can anyone help me on this …?

Hi All,

Finally able to design the requirement as i wanted with the help of java script engine.
Now the entire input can be dynamic.
(Extensive testing is pending, Hope no issues will come)

As a result entire conditions which are required in interfaces can be replaced with this.

And more over, the ternary operator is always faster than the branch conditions.

Yes you can do more with regular expressions in the Branch/sequence for a dynamic scenario handling and you might be in the right track…

HTH,
RMG