As I was playing with the taxonomy conditions, I thought... it would be neat to be able to load a term to compare with another. Or have an action that can be used to load the parent term of a term that's currently available.
But I do not see how that would work in the current implementation.
What I'm thinking is that the conditions and actions should not be separated and then you could do something like this:
- Load Term
- Compare Term to Term
- (Continue only if True)
- Load Another Term
- Assign Term to Node
I'm sure you can imagine how complicated that could become. Of course, branches would be even more fabulous...
Load Term
Compare Term to Term
If True Then DoThis
Load Another Term
Assign Term to Node
Return
DoThis:
Load Yet Another Term
Assign Term to Node
But I guess I'm getting a bit out of it here. 8-)
This last thing is already doable by creating the opposite condition in a separate rule. With real long rules, it could be quite annoying to have to do everything twice each time.
Now a good thing that should be easy enough would be to allow two lists of actions: the TRUE list and the FALSE list. So that way if some user gets a new role, I could do something, and if they lose the role, I could do the opposite right there in the same rule. And if the conditions and actions are already allowed to be mixed, then all we need to add is a special "condition" to invert the condition:
- Load Term
- Compare Term to Term
- Then
- Load Another Term
- Assign Term to Node
- Else (inverse current condition status)
- Load Another Term
- Assign Term to Node
Let me know what you think.
Thank you.
Alexis Wilke
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | Snap1.png | 26.53 KB | amitaibu |
| #6 | Screenshot.png | 34.98 KB | AlexisWilke |
Comments
Comment #1
amitaibuyou can already do it by having 2 rules with the same event - make sure the 2nd event has bigger weight - when it will be evaluated it will have all the arguments loaded in the 1st rule.
Please re-open issue if something is not clear.
Comment #2
AlexisWilke commentedAmitaibu,
If my condition requires 4 or 5 entries with complex setup, it is quite annoying to set that up for 2 rules. And maintenance wise, if I made a mistake, I have to edit two rules. And I won't even mention how difficult it is for most people to apply a not properly on complex conditions (with AND and OR, etc.) Now I don't see why the weight would play a role in there though. One rule will have a condition that is true when the other is false anyway.
Also this is far from just being an event + condition + action, which maybe you want to limit the module to just that forever.
What I'm saying here is that you could have things in whatever order. You probably need an event to start a rule, then you may want to load some things to complete your tests. At this time, I have to do that by code (PHP) if the condition does not exist in house.
What I'm proposing is a way to do things so it allows for a lot more possibilities without having to write PHP code each time.
Plus, on one event, I may want many different things to happen and instead of creating a new rule each time, I could do everything in one rule.
For instance, I'd like to setup 3 or 4 things on any new registering user. At this time I have to create 3 or 4 rules, each with the same event, a slightly different condition and one or two actions. It would look more straight forward if I were able to put all of it in a single rule. Also this specific example is probably less important at this time, there are cases when it could be quite useful.
Thank you.
Alexis
Comment #3
amitaibuI remember i was thinking about a similar thing #228710-2: WF_ng wishlist for D6
>Cases - I haven't got a clear idea about it, but here's the user case: I need to check 2 condition one of them is loading a user, and act differently if All True, All False, True && False. For this I need to create 3 different configurations, and each time load the user. However, adding such a feature might be overcomplicating.
which fago answered:
> That's already possible, as rule configuration is ordered. Load the user in rule 1, set it to weight -10. Then use it in further rules with higher weights.
So regarding your case from the original issue:
You can add rule set called term operations (which will answer "Plus, on one event, I may want many different things to happen and instead of creating a new rule each time, I could do everything in one rule.")
* The first rule with weight -5 will load term.
* A second rule with weight 0 will compare the terms and if true load another term.
* Third rule with weigt 5 will asign the term to the node. If the term wasn't loaded in the second rule the 3rd will be aborted as the term argument will be missing.
Comment #4
AlexisWilke commentedAmitaibu,
That makes more sense, thank you for taking the time of explaining in more details. Although, it still does not resolve the case were complex conditions need to be reversed (NOT condition.)
Also, it is not clear that this is the case. It looks like a rule is a rule and not a set of sub-statements that continue one after another.
What would be easy to add is a set of ELSE actions. That would "just" be a new set of actions that are executed only if the condition is false. Maybe that would be acceptable?
Thank you.
Alexis
Comment #5
amitaibuI think that if-else, might enter more complexity to the Rules code. If the question now is what is better - user complexity Vs code - I'm not sure. For now I would say, leave things as is - I think that the bigger problem is that cases like yours and the use of rule sets is still not clear - due to lack of good tutorials.
> Although, it still does not resolve the case were complex conditions need to be reversed (NOT condition.)
I think you can do it, just need to know what exactly your cases are (maybe have several rules sets). If the UI is too complex, you can always code your rules; or sometimes having a custom module is also a good approach IMO.
Comment #6
AlexisWilke commentedJust in case, there is an image of what I'm thinking about. It does not look too complex to me. 8-)
On the other hand, it may rarely be useful...
Comment #7
amitaibuAs much as I dislike saying copy stuff... But, you can create two rule sets and have all the conditions inside a condition group - and in the second rule check the 'Negate' option.
Comment #8
AlexisWilke commentedAmitaibu,
Well... you're the one who was telling me that things should be simpler, not more complicated... 8-)
I think all of that would require a well written document and it looks like I don't know enough to write it!
Thank you for your patience.
Alexis