Page 1 of 1

AND OR XOR in EXEC_COMMAND2

Posted: 30 Jun 2022 17:17
by fred48fm
Hi,

It could be usefull to add the ability to use conditions for the EXEC_COMMAND2 command.

For now we need to use long commands like this :
EXEC_COMMAND2 VAR1|Equals(1)|EXEC_COMMAND2 VAR2|Equals(1)|EXEC_COMMAND2 VAR3|Equals(1)|command

Something like EXEC_COMMAND2 VAR1|Equals(1) && VAR2|Equals(1) && VAR3|Equals(1)|command could be really nice.

Thanks

Fred

Re: AND OR XOR in EXEC_COMMAND2

Posted: 30 Jun 2022 22:55
by radio42
Note, that you combine multiple variables (as they are simply treated as a string). E.g. in your example above you might use:
EXEC_COMMAND2 VAR1VAR2VAR3|Equals(111)|command

Explanation: VAR1, VAR2, VAR3 are simply concatenated (placed after each other) and then compared to the string "111".
This condition will will only be true, if all VARs are "1".

An OR condition could be solved similar:
EXEC_COMMAND2 VAR1VAR2VAR3|NOT(Equals(000))|command

Explanation: If either VAR1, VAR2 or VAR3 is "1" it will not be "000".

You might also take a look to the *[IF:...] resp. even other transformation macro function with which almost any logical combination is possible.
Also the "InList" condition might help...