[rules-users] How to write a rule that fires when it matches against specific facts in working memory.

Edson Tirelli ed.tirelli at gmail.com
Mon Jan 24 09:37:34 EST 2011


   Given that your restriction is "this 'options' and only them, at least
one instance of each", and you need that in a "generic way", best is for you
to create your own accumulate function. For Drools 5.1.1 your template would
look like:

$options : List() from accumulate(
      $op : Option(),
      matchAll( [ ${param}, $op ] ) )

   Where ${param} is the list of options the user type in the decision table
cell and matchAll is your own accumulate function with the semantics you
described.

   Edson


2011/1/21 groovenarula <gnarula1 at la-z-boy.com>

>
> Thanks for the options, Bruno and Wolfgang.
>
> But is there a more 'generic' way to do the matches ? The problem I have is
> that the # of instances that might match could vary. And I have to provide
> a
> means for the business users to be able to provide that 'option's code'
> using a decision table. Basically I need to be able to provide a construct
> that's would look something like :
>
>    Options
>    "P1,P2"
>    "P1,P4,P5"
>
> So in the above decision table had 2 rules where in the first row
> represents
> a rule that matches against Options with Codes P1 and P2. And the second
> rule would match against options with codes P1, P4 and P5.
>
> Is it possible to represent this using Drools decision tables ?
>
> Thanks
> Gurvinder
>
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/How-to-write-a-rule-that-fires-when-it-matches-against-specific-facts-in-working-memory-tp2294599p2300564.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110124/1cc8ecaa/attachment.html 


More information about the rules-users mailing list