easy-rules icon indicating copy to clipboard operation
easy-rules copied to clipboard

How to add fact in action?

Open shabir1 opened this issue 3 years ago • 1 comments

In V3 we were able to add fact in action but it is not working in V4. e.g in V3 facts = [{isRaining : true}]

Rule rule1 = new MVELRule() .name("Rule 1") .priority(0) .when("isRaining==true") .then("System.out.println(\"It rains, take an umbrella!\");"weather=\"wet\";umbrella=isRaining""); rules.register(rule1); rulesEngine.fire(rules, facts);

V3 result fact: [{isRaining : true}, {weather : "wet"}, {umbrella : true}]

V4 result fact: [{isRaining : true}] for same input and rule.

shabir1 avatar Nov 08 '21 08:11 shabir1

See FAQ https://github.com/j-easy/easy-rules/wiki/faqs#8-how-to-addassign-new-facts-in-rules-written-in-an-expression-language

chhil avatar Dec 02 '21 10:12 chhil