I need to count the number of facts satisfying a certain constraint in working memory and then fire the rule if the number of facts breaches a certain threshold. I tried the following but it is complaining about "mismatched input '$cnt' in rule "Rule1"
rule Rule1
when
accumulate ( AFact ( code == "XXXX" ); $cnt : count(1) ; $cnt > 1 )
then
// fire
end
Any help to get the syntax right would be appreciated. Thanks!