[rules-dev] Fact counts in drools

Mark Proctor mproctor at codehaus.org
Thu Mar 29 10:41:53 EDT 2007


This is a user question, please post it to the rules user list.

Mark
Jim Majure wrote:
> 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-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20070329/eb8a7ed5/attachment.html 


More information about the rules-dev mailing list