# OR in Rule Engine

Hi,

How can I write this function in rule engine:

if a > (b OR c OR d OR e) => “a > b”

I write: \$a\$ > \$b\$ OR \$c\$ => “a > b” and it didn’t work.

How can i solve it?

The right way of writing this multiple condition in a rule engine is as follows:

(\$a\$ > \$b\$) OR (\$a\$ > \$c\$) OR  (\$a\$ > \$d\$) OR (\$a\$ > \$e\$) => "a > others"
TRUE => "a <= others"

Is that what you need ?
Hope it helps.

Best
Ael

4 Likes

Thank you!
It’s works

1 Like

@aworker Can you help me with another question?

(\$string1\$ = “text1”) AND (\$string2\$ = “text2”) AND \$number\$ = 0 AND \$string\$ = “1” => “Solution1”

What I’m doing wrong here? Its not error in rule engine node, but i dont have any results on new column.

you have written a series of conditions. When true, your input is “Solution 1”, but what happens if not true?

Try this:

(\$string1\$ = “text1”) AND (\$string2\$ = “text2”) AND \$number\$ = 0 AND \$string\$ = “1” => “Solution1”
TRUE => "Solution2"

Rule engine works line by line. If the first condition is not met, the second one will be assessed. In the case above, when condition #1 is FALSE, the second one is always TRUE.

Have a nice day,
Raffaello

3 Likes

I like to think of that last TRUE => “something” line of the equation as the final “else” of an if statement. If you say “else” to yourself as you type ”TRUE => “ for a while it will become second nature pretty quickly.

2 Likes

Maybe try the following:

(\$string1\$ = "text1") AND (\$string2\$ = "text2") AND (\$number\$ = 0) AND (\$string\$ = "1") => "Solution1"
TRUE => "Solution2"

Best
Ael

1 Like

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