Chandresh Mishra
Chandresh Mishra

Reputation: 1189

Drools Collection Iteration

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.

Upvotes: 0

Views: 239

Answers (1)

Esteban Aliverti
Esteban Aliverti

Reputation: 6322

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,

Upvotes: 1

Related Questions