0

what's Wrong with this rule.

rule "Organization Employee Rule"
    when

        $company: CompanyFact( $emp: /employeeList{organizationName== "XYZ"})

    then
        System.out.println("Employee in organization" +$emp);
end

I am getting this error while trying to run this rule.

[ERR 102] Line 23:44 mismatched input '{' in rule "Organization Employee Rule"

CompanyFact has list of Employee and Employee has String organization name.

Chandresh Mishra
  • 1,081
  • 3
  • 24
  • 45

1 Answers1

1

If you are using Drools 7.x, they changed the OOPath syntax to make it closer to XPath.

Try to use square brackets instead of curly ones:

rule "Organization Employee Rule"
when
    $company: CompanyFact( $emp: /employeeList[organizationName== "XYZ"])
then
    System.out.println("Employee in organization" +$emp);
end

Hope it helps,

Esteban Aliverti
  • 6,259
  • 2
  • 19
  • 31