I am trying to work with easy-rules.
Can we have an if-else rule executed using easy-rules?
I have checked on ActivationRuleGroup and ConditionalRuleGroup, but it seems it's only all if's.
I am trying to work with easy-rules.
Can we have an if-else rule executed using easy-rules?
I have checked on ActivationRuleGroup and ConditionalRuleGroup, but it seems it's only all if's.
Copyright © 2021 Jogjafile Inc.
All rules are if-then, there is no else; it's a different kind of thinking. Rules are not meant to replace just any logic you see in your average source code. They're best implemented for things akin to long switch-case-like logic or parameter-driven logic. Income tax forms are an example of a parameter-driven use-case.
If you need three actions based on the value of one fact, for example:
Then you simply write 3 rules:
The Composite rules are used for handling groups of rules.
ConditionalRuleGrouphas one "primary" rule such that when it evaluates totrue(triggered), then the remainder of the rules in the group are fired otherwise the group is skipped.I use
UnitRuleGroupfor form-like validation. All of the data from a form is put into thefactsand the validation rules are fired. If any one of the rules is false, then the whole group returns false and the form is deemed invalid.