You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The below example results in an Exception: "Exception while parsing expression !string.IsNullOrEmpty(Acceptor.Company) - No property or field 'Company' exists in type 'Acceptor'"
List ruleParams2 = new();
ruleParams2.Add(new RuleParameter("Acceptor", ap));
var re = new RulesEngine.RulesEngine(workflows.ToArray());
var result = await re.ExecuteAllRulesAsync("Example Workflow", ruleParams2.ToArray());`
Changing the Rule Parameter Name to pAcceptor executes successfully with no exception. Successful code below... not sure why the word acceptor breaks the expression but it does...
The below example results in an Exception: "Exception while parsing expression
!string.IsNullOrEmpty(Acceptor.Company)
- No property or field 'Company' exists in type 'Acceptor'"`List rules = new List();
Rule rule = new Rule();
rule.RuleName = "Test Rule";
rule.SuccessEvent = "true";
rule.ErrorMessage = "Test Error";
rule.Expression = "!string.IsNullOrEmpty(Acceptor.Company)";
rule.RuleExpressionType = RuleExpressionType.LambdaExpression;
rules.Add(rule);
var workflows = new List();
Workflow exampleWorkflow = new Workflow();
exampleWorkflow.WorkflowName = "Example Workflow";
exampleWorkflow.Rules = rules;
workflows.Add(exampleWorkflow);
Acceptor ap = new();
ap.Company = "";
List ruleParams2 = new();
ruleParams2.Add(new RuleParameter("Acceptor", ap));
var re = new RulesEngine.RulesEngine(workflows.ToArray());
var result = await re.ExecuteAllRulesAsync("Example Workflow", ruleParams2.ToArray());`
Changing the Rule Parameter Name to pAcceptor executes successfully with no exception. Successful code below... not sure why the word acceptor breaks the expression but it does...
`List rules = new List();
Rule rule = new Rule();
rule.RuleName = "Test Rule";
rule.SuccessEvent = "true";
rule.ErrorMessage = "Test Error";
rule.Expression = "!string.IsNullOrEmpty(pAcceptor.Company)";
rule.RuleExpressionType = RuleExpressionType.LambdaExpression;
rules.Add(rule);
var workflows = new List();
Workflow workFlow = new Workflow();
workFlow.WorkflowName = "Example Workflow";
workFlow.Rules = rules;
workflows.Add(workFlow);
Acceptor ap = new();
ap.FirstName = "";
ap.LastName = "";
ap.Company = "";
List rParameters = new();
rParameters.Add(new RuleParameter("pAcceptor", ap));
var re = new RulesEngine.RulesEngine(workflows.ToArray());
var r = await re.ExecuteAllRulesAsync("Example Workflow", rParameters.ToArray());`
The text was updated successfully, but these errors were encountered: