1

I am using Rules with Rules Once Per a Day. Although Once Per a Day is not part of the default Rules, the general core of my question applies to default Rules.

I want Rules per Once a day to activate either on Monday or Thursday. To do this I am using an OR condition:

screen shot of OR statement

But it did not work. Is my OR statement set up correctly?

I’ve looked at several Drupal Rules tutorials about creating OR conditions, but they all seem to give different advice. Some say you need a separate OR grouping for each condition, others say all the conditions need to be in one OR group.

NB: My rule exists on the main rules screen and NOT under the components tab.

  • You have your answer below, but I just wanted to point out that enabling the Rules Debug Log in Rules settings can sometimes help flag issues like these. – othermachines Aug 10 '15 at 17:15
  • The OR condition has a little bit of a confusing UI, as it really means "And either of the following." So as the guys pointed out, it comes before the 2 choices, not between them. It's not used like we would use "or" in a sentence. – TonyTheFerg Nov 26 at 14:27
5

Both the conditions should be nested under the "OR" line like this:

+ OR
  + Current day of the week (is Monday)
  + Current day of the week (is Thursday)

What you have at the moment is a clause that says "if the current day of the week is a Monday and one of the following conditions is true: the day of the week is Thursday"

1

Error in your current conditions

Your rule is not setup correctly. The logic you have in your "conditions" is like so:

  • Current day of week is Monday
  • AND one of the next conditions in the OR group must be true:
    • Current day of week is Thursday.
    • OR ... nothing else (full stop).

So the condition will never be met: not on Monday, not on Thurday, and not on any other day.

What should work, is that you move the Monday-condition below the OR, and also indent it (same indent as for Thursday).

If you'd ever add some other condition, say ABC (at the top, before the OR), and with the Monday-condition moved as in my prior paragraph, then that ABC-condition will be combined with an AND with the (Monday OR Thursday) condition.

For an interesting video tutorial about this, refer to "Combining conditions". Somewhere around '9:00' (near the end), it has a similar OR condition. Here is a summary of that tutorial:

  • How to be confused over the positioning of the AND and OR statements
  • How to combine conditions with AND requirements
  • How to combine conditions with OR requirements
  • How to combine AND and OR groups to create complex conditions
  • Some advice about the order of conditions
  • How to delete reaction rules
  • Why you shouldn't use the "send e-mail to all users in a role" action
  • Why it might be useful to have messages printed out when configuring complex rules

Alternative solution

For a possible solution (or at least a work around), refer to my answer to the question "How to publish nodes 3 times a day?".

In your case, you could make it work by creating 2 similar rules, 1 of them to run only on Monday, the other one only on Thursday. That would work also. It's what I sometimes do if multiple AND/OR conditions to be combined are getting too complex (to enhance it's readability).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.