Martijn Burger
Martijn Burger

Reputation: 7543

Mvel expression not working in Drools

I have the following Java rule in a Drools LHS:

Policy(((Person)contacts.get(0)).getHouseHold() == null)

This works. I was expecting that I could change that to an mvel expression like this:

Policy(contacts[0]#Person.houseHold == null)

or this:

Policy((contacts[0])#Person.houseHold == null)

or even this:

Policy(((contacts[0])#Person).houseHold == null)

This however gives the following error when I compile the drools rules:

mismatched input '#' in rule "Rule1"

What's wrong with my mvel expression?

Upvotes: 0

Views: 460

Answers (1)

Martijn Burger
Martijn Burger

Reputation: 7543

This works:

$contact: contacts[0], $contact#Person.houseHold == null

I guess mvel or drools cannot handle a typecast of an element of a list directly.

Upvotes: 1

Related Questions