If you are using 3.1M1 or later (trunk), you can do:
rule xyz
when
Treatment( $id : id, status == "pending" )
ArrayList( size >= 70 ) from ( Treatment( id == $id, status == "paid" )
)
then
assert( new Rejection( "reason" ) )
end
If you are using 3.0.x, you will need 2 rules. One rule will count the
occurrences and the other will check if total is greater than 70.
[]s
Edson
2007/3/29, Jim Majure <Jim(a)sourceallies.com>:
I have what I think is a very simple rule to implement, but I can't find a
way to do it without "cheating" by using an eval/function. Here's the
basic
rule in English:
**
Reject a claim if it contains a treatment that has already been claimed more than 70
times
in the same calendar month.
In other words, I need to count the number of instances of the treatment
that have already been paid.
Assume for the sake of this discussion, my facts are instances of the
Treatment class.
If I replace "70" with, say, "2" in this rule I could do this:
**
rule
when
Treatment(id=="t1", status=="pending")
Treatment(id=="t1", status=="paid")
Treatment(id=="t1", status=="paid")
then
assert ( new Rejection("reason"));
end
Unfortunately, I can't simply replace "70" with "2", and using
the same
strategy to check for 70 instances doesn't seem quite right.
Am I missing something very simple here? Are there standard strategies to
deal with this type of rule?
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @
www.jboss.com