0 Replies Latest reply on Mar 16, 2007 4:01 PM by Jim Majure

    Fact counts in drools

    Jim Majure Newbie

      I'm not sure if this is the right location for this type of question, but since I don't see a drools-specific forum and I do see drools posts in this forum, here goes...

      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:

       Treatment(id=="t1", status=="pending")
       Treatment(id=="t1", status=="paid")
       Treatment(id=="t1", status=="paid")
       assert ( new Rejection("reason"));

      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?