RulesEngine usecase examples #86
Replies: 3 comments
-
Hi Team, Can we use this rule engine if the conditions are occurring at different point in time. The action should execute only if both the Events are occurred. eg: Event1, Event2 Thank You, |
Beta Was this translation helpful? Give feedback.
-
I Want to have the list Contain method in my rule. for example, I need to check that my name property of the given object is among multiple options like ("tom", "jimmy", bob): I tried it but the defined rule was not triggered on my object: var rule = new Rule
{
RuleName = "ExistIn",
Enabled = true,
Expression = "histack.Contains(Name)",
RuleExpressionType = RuleExpressionType.LambdaExpression,
SuccessEvent = "30",
LocalParams = new List<ScopedParam>
{
new LocalParam
{
Name = "histack",
Expression = "new List<string> {\"Tom\",\"Jimmy\", \"Bob\"}"
}
},
Actions = new RuleActions
{
OnSuccess = new ActionInfo
{
Name = "OutputExpression",
Context = new Dictionary<string, object>
{
{ "Expression", "\"hooray\"" }
},
}
}
}; My object is like this: var p = new Person{Name = "Bob"}; and I tried to apply rules by this code on my object: var rules = new List<Rule>();
rules.Add(rule);
var workFlow = new Workflow();
workFlow.WorkflowName = "test";
workFlow.Rules = rules;
var ruleEngine = new RulesEngine.RulesEngine(new Workflow[]{workFlow}.ToArray());
var t = await ruleEngine.ExecuteAllRulesAsync("test",
new RuleParameter("item", p);
t.OnSuccess(name =>
{
Console.WriteLine($"{name} Done!!!");
});
}
|
Beta Was this translation helpful? Give feedback.
-
I have 2 concrete examples. The first one is at a Telecom-company where the rulesengine is used to determine all the tasks to be executed outside in the field by a technician when a customer is connected. We have several rules in place taking arguments fed from the utility-registration system, the ruleengine then has a set of rules who inturn are related to some other classes returning json-structures holding information about the patches to be made outside. The second one is at a logistics system where orders are incoming in a system and the ruleengine is used to ensure all the rules are met before an order can be processed. In my experience, the rulesengine has quit a steep learning curve mostly because a lack of good examples and also because Chatgpt is not fully aware of it. |
Beta Was this translation helpful? Give feedback.
-
Starting this discussion to share usage examples for RulesEngine.
Please share how you are leveraging RulesEngine to solve various business problems.
This will enable community to understand different use-cases as well as the full potential of RulesEngine.
Beta Was this translation helpful? Give feedback.
All reactions