Hi,

I was having a problem, stated in #781580: Using Rules on viewing content to see if a certain field in author's Content Profile is set and I solved it with a triggered rule and a rule set.

In short, I used a triggered rule to capture a event, specified some condition, and load all the required objects to be processed and pass them to a rule set to do the real work.

For my case, the real work (actions) is just "send a email to content author" and the conditions are
1. current user is not the content author
2. content viewed is published with certain types
3. author specified that he want to receive email in his content profile.

In the current triggered rule,

in triggered rule:
if 
  condition meet
do 
  load objects to be process
  execute a rule set which do real work with the load objects

I can only put the first 2 condition into the triggered rule, and place the last condition into the rule set.

While I can reach my goal, I am wondering if it is possible to add extra section of actions before the condition for triggered rules. This, I think, can help to simplify the setup and eliminate extra rule set, like this,

in the enhanced triggered rule:
do
  load objects to be process
if 
  condition meet
do 
  real work 

The benefits are

  1. rule for the scenario is easier to setup and be understood
  2. execution may be faster, as there is no need for system to load and handle extra rule set

I am new to rules and I am not sure if this is feature is good. Please correct me if the mentioned scenario can be handled by the module in a more efficient way.

Comments

mitchell’s picture

Status: Active » Fixed

I'm not sure if I understand 100%, so here are some things that may help.

You can put both a 'load a node by nid' and 'run a rule set' in the same rule and have the rule set use values from the loaded node. So while, it may not look right, you can do what you're asking about in the admin interface. However, it won't be displayed how you would expect. I'll file this one in #563996: [Meta] Improve Rules UI UX.

You may also be interested in: Optimize the performance of evaluation part of rule sets.

robonoob’s picture

Status: Fixed » Active

Hmm....

I got what you mean. However, I think I did not present my problem clearly.

I want to check a value in author's content profile before doing some work. However, in order to get the value, I must use a rule and get the value in the DO block, before I can check the value. Simply put, I simply find that there is no way for me to get a value of a field in author's content profile and have it checked against a boolean, or an integer value, into a single rule's condition block.

You mentioned a rule and a rule set. Yes, that was what I used to solve my scenario. While this works for me, I don't think it is easy for people to split a common task into a rule and a rule set. It just way too complicated.

Currently, the logical construct of the triggered rule is something like this...

if (some condition), do (something)

If the logical construct of the triggered rule changed to something like this,

do (some actions)
if (some condition), do (other action)

I can get a particular value in author's content profile and have it checked later on. Then I can do some action based on the value I got. And the whole case can be expressed in one single triggered rule.

Maybe this is my particular case. However, I still think that adding extra DO section in triggered rule can make it more intuitive (at least, there is no need to create another rule set)

Anyway. Thanks for the links. Those are worth read.

fago’s picture

Version: 6.x-1.2 » 7.x-2.x-dev
Status: Active » Fixed

>I want to check a value in author's content profile before doing some work. However, in order to get the value, I must use a rule and get the value in the DO block, before I can check the value.

I see your problem. However I don't like complicating the simple and well-known structure of E-C-A further. Next I don't like to such big changes in 6.x - development moves to 7.x.. However things got already improved there, thanks to data selector. There is content profile yet in 7.x, but it could make a selector like node:author:profile-type work. So the explicit loading action is much less needed.

fago’s picture

Status: Fixed » Closed (won't fix)
robonoob’s picture

Thanks for the clarification.

I would love to see if the data selector be improved in near future.