-
|
Hello. I am wondering if there is a way to halt rule evaluation once the engine has found a matching rule. I have played around with a combination of rules and operators but it seems like the engine evaluates all rules in a workflow. As an example: In the example above any input that causes the first rule to be true will also cause the second rule to be true. The behavior I want is basically an Is the functionality I am describing in the rules engine? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
It is not possible at workflow level but is available at nest rule level. [
{
"WorkflowName": "WelcomeEmail",
"Rules": [
{
"RuleName":"CheckState",
"Operator": "Or",
"Rules":[
{
"RuleName": "Cleveland",
"SuccessEvent": "10",
"ErrorMessage": "Cleveland rule failed",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input1.State == \"OH\" AND input1.city == \"Cleveland\""
},
{
"RuleName": "GeneralOhio",
"SuccessEvent": "20",
"ErrorMessage": "Ohio rule failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input1.State == \"OH\""
}
]
}
]
}
]And you need to set the following ReSettings in the rules engine: var reSettings = new ReSettings(){
NestedRuleExecutionMode = NestedRuleExecutionMode.Performance
}
var ruleEngine = new RulesEngine(workflows,logger,reSettings); |
Beta Was this translation helpful? Give feedback.
It is not possible at workflow level but is available at nest rule level.
You can achieve it by modifying the workflow a little.
[ { "WorkflowName": "WelcomeEmail", "Rules": [ { "RuleName":"CheckState", "Operator": "Or", "Rules":[ { "RuleName": "Cleveland", "SuccessEvent": "10", "ErrorMessage": "Cleveland rule failed", "ErrorType": "Error", "RuleExpressionType": "LambdaExpression", "Expression": "input1.State == \"OH\" AND input1.city == \"Cleveland\"" }, { …