Run condition with OR logic

Hello all,

I’m trying to implement some OR logic in my projects run conditions.

The idea would be to execute some steps only if Variable01 OR Variable02 is true.

For instance, I’m now using :
#{GameProvider01.Deploy}

I would like to be able to do :
#{GameProvider01.Deploy} OR #{GameProvider02.Deploy}

… because I can’t predict which variable my user will check in advance (it could be 01 or 02).

I’ve read the documentation but couldn’t find any example about the OR operator.

Regards,
Damien

Hi Damien,

Thanks for reaching out. Unfortunately, there is no inherent OR logic built into the run conditions, but you can do it with an if-else.

Given my example:
aOne == False
aTwo == True

#{if aOne}True#{else}#{aTwo}#{/if}

aOne will evaluate to false, going to the else, which will variable substitute aTwo, giving it True and cause the step to run. If aOne is true, it will just evaluate to True, and if aTwo is false, both will evaluate to false and the step will not run. It’s not pretty, but it should work for your use case.

An alternative method would be to have a separate script step that evaluates the OR logic within PowerShell, then uses an output variable to create a new variable which will then be used as the run condition in the later step.

Please let me know if that works for you or if you have any questions.

Thanks,
Jeremy

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