Compare more than one variable in if-else condition

Hi there,

is it possible to compare more than one variable at the same time in an if-else condition (as shown in the picture below) or do I have to create several if-else actions? If yes, what do I have to use to connect the different variables (AND, &, &&…)?

Thank you very much!


Hi @rebecca.r.haas we don’t support such option yet, although we are planning to add it in the future versions.
The example you provided above should work provided you use AND as the logic operator, but the sure way to insert multiple conditions is to use several nested if-else actions.

You could do this in a custom script as well. Here is an example that does what you want for arithmetic comparisons. It provides a BOOLEAN result for multiple comparisons of arithmetic operations. In recorder I have made three variables “condition1, 2, 3” and boolean_result.

The function returns TRUE if all conditions are TRUE for my logic, of course you can do whatever logic you want. This avoids nested IF statements, simply compare boolean_result against true or false to proceed.


    input = ['condition1', 'condition2', 'condition3'],
    output = 'boolean_result'

    def customScript() {

    // This is an example that does comparisons for arithmetic operations. You could also do other operations
    // For example text compare, regex, etc are all possible. You can make as many logical operations as you want.

    // The script outputs TRUE if ALL conditions are True, otherwise it outputs FALSE

    def c1 = RNumber.of(condition1)
    def c2 = RNumber.of(condition2)
    def c3 = RNumber.of(condition3)

            (c1 < c2)  &&    // "&&" is the logical operator AND
            (c2 <c3)   &&    // This structure allows you avoid nested "IF" statements in recorder
            (c2*c3 < 10)     // by using one BOOLEAN result in one IF branch.
           def boolean_result = RBoolean.of(true)
         } else{
           def boolean_result = RBoolean.of(false)