CodeEffects RuleSets: which rules were applied?

70 Views Asked by At

I have 250 Execution rules. Today, I evaluate them 1 at a time in a loop in order. The first one that evaluates true stops the loop. I save off the result and which rule was used.

I would like to use a ruleset for performance reasons. Is there a way to know which rule (or rules depending on behavior) evaluated true? Maybe an array of the ruleids?

1

There are 1 best solutions below

2
Alex On

Declare a "state" field in your source class and set its value to the rule evaluation result for each rule in your ruleset. Check the value of that field after the evaluation of your ruleset is finished to determine which rule(s) has evaluated to true:

[ExcludeFromEvaluation]
public string Output;

[Action("Output")]
public void SetOutput(string val)
{
   this.Output += val;
}

The rule example:

If Something is True then Output ( "Something was true" ) and Do Something Amazing