[rules-users] Nested Collect probably

Chris B sunnycal99 at gmail.com
Mon May 26 04:03:12 EDT 2014


I have a class

Employee
(name)

Certificates
(course, year, employee)

If the employees have CCNA & CCNP from the “same” year and then if they took
“CCIE or J5SE in 2000”  or “J4WS in 2001 or 2002, or 2003”
The Action should be taken if there are more than 5 such employees.

The connection between Employee and Certificates is through
Certificates.employee, but I can change it to a list of certificates in
Employee also if needed.

I start with
$e: Employee()
Certificate (employee == $e, course == “CCNA”, $ccnaYear : year)
Certificate (employee == $e, course == “CCNP”, $ccnpYear : year)
//this will get the years for one employee..
//now we need to get all other employees from same year..
//but we still need to make sure all certificates are from the same
employee.
ArrayList( size >= 2 ) from collect(Certificate (
((course == “CCNA”, year == $ccnaYear, $e_this:employee) && (course ==
“CCNP”, year == $ccnpYear, employee == $e_this))
&&
(
((course == “CCIE”, year == 2000, employee == $e_this) || (course == J5SE”,
year == 2000, employee == $e_this))
||
((course == “J4WS”, year == 2001, employee == $e_this) || (course == “J4WS”,
year == 2002, employee == $e_this) || (course == “J4WS”, year == 2003,
employee == $e_this))
)
)

This is going crazy at this stage.
First problem, - I start with one employee, and try to get his years of CCNA
and CCNP
Next I am collecting Certificates instead of Employees which I should be
collecting and checking the length of the employees.

I think something like this will help me
http://blog.athico.com/2007/06/chained-from-accumulate-collect.html
But I am unable to convert it into my usecase.

Please help.
Thanks




--
View this message in context: http://drools.46999.n3.nabble.com/Nested-Collect-probably-tp4029681.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list