I have a problem with a required expression that does not work as intended. Sunday to Thursday works, but not Friday to Saturday. The idea is that the rule should be allowed to run between 14: 00-21: 00 Sunday to Thursday if PB is false, which works fine. Friday to Saturday, the rule should be allowed to run between 14: 00-23: 00 if PB is false which does not work, what have I done wrong in my required expression?
You need parentheses. The order of evaluation is not what you think it is.
Looks like some parentheses would help for the boolean logic - I think RM mentions "sub-rules" to insert parentheses...
PB is false AND
(Day Sun-Thurs AND 14:00-21:00) OR
(Day Fri-Sat AND 14:00-23:00)
You need to group your expression. Right now Day in [M, T, W, Th, Su] is (F) making the entire expression [FALSE]. I think you want
What @pseudonym said - the double paren is best
Wow, thanks for all quick replies, this forum is gr8 .
I will try with parantheses as you suggest.
Thinking about this some more, here's an option that moves the PB to the end and can eliminate the double parentheses. It'll rely on order of operation.
This example was wrong...
It would be interesting to know if the Rule Machine can perform short circuit evaluations of IF expressions. I write my rules hoping it can, but have the feeling it probably doesn't
No, it does, which is why I put most likely bail out expression first. You can find Bruce’s reply to me in one of the RM 5.x threads when complex expressions were introduced and I asked.
EDIT: here it is:
Thanks for heads up with the link. Very interesting and impressive to know. I've always put my most likely expressions first out of very old programming habits. Nice to know it pays off with RM.
Thanks again, have I understood this right? The example below would also work, the only difference is that it´s PB that is parent days / time compared to the example where PB is last where days / time is parent, if you understand what I mean? Unfortunately I am not very good at English so this is written using Goggle
I believe your example is correct. If PB is false the entire expression is false. If PB is true then it needs either of the next two to be true.