How can I use the results of a view as a condition in a rule?

I have rule that fires off a daily digest email with contents from a view (using Views Rules). The view simply returns nodes that have a specific field value. When the view doesn't return any nodes, the rule still fires off what is essentially an empty email. I want to prevent this. I need a condition like "View has no results" (negated)… but I don't see anything like that. What's the workaround?

2 Answers 2


Even though your own answer is indeed a way to solve your question, it doesn't say that for this to work, it requires the Conditional Rules module to be enabled (without that, you cannot add a Rules Condition as an extra rules Action).

An alternative solution to solve your question, is to use the Views Bulk Operations (VBO) module to transform your view into a VBO view, so that you can use a Rules Condition "Check number of results returned by a VBO View" in which you can perfectly construct the Rules Condition you're looking for.

Have a look at "this answer" for an illustration of how this specific Rules Condition is used.

PS: I'm assuming this question is about D7.


I was eventually able to pull this off by adding a condition to the Actions section, as opposed to the (more logical) Conditions section. Here's what I did:

  1. Added a conditional to the Actions section
  2. Added an if to the conditional
  3. Added the Data value is empty condition and negated it
  4. The Data to check is one of the fields from my view, in my case [created:0]
  5. Added the action (in my case, Send mail to all users of a role) and nested it under this new condition

While this does seem to work, it feels like more of a workaround than a solution. But, hey, if it works, it works. Anyway, I'm open to more direct approaches if they're out there.

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.