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

2011-02-09 Thread groovenarula
Wolfgang - adding the dialect to the 'Functions' cell worked like a charm. Edson's solution did not work without the dialect mvel. So in this case MVEL is a must have. But then your suggestion to add the dialect next to the cell keyed Functions worked. Thanks again for your help. -- View this

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

2011-02-05 Thread groovenarula
Edson/Wolfgang, Thanks to your suggestions, I've got this working the way I need it using rules defined in a .drl file. I think I have just one hurdle left before I start working out how to get it working through decision tables - and that is how to specific 'mvel' dialect for decision tables.

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

2011-01-29 Thread groovenarula
Edson, I did manage to use the 'CollectSetAccumulateFunction' as a template for the MatchAll and have also successfully 'called' the accumulate function from a rule written in a .drl file. But I'm stuck at one point - how to send the value of $param to the accumulate method ? From what I

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

2011-01-29 Thread Edson Tirelli
Up to Drools 5, the accumulate function API supports only a single argument to the function, but that argument can be an array or a list. So what I do on my own implementations is to pass the $param as one element of the array and $o as the other. It is not ideal, but it is how you can do that

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

2011-01-29 Thread groovenarula
Edson, That worked beautifully ! Drools is looking more and more promising for what we need to do. Thanks for all your help, Gurvinder -Original Message- From: Edson Tirelli-4 [via Drools - Java Rules Engine] [mailto:ml-node+2380361-572428564-9...@n3.nabble.com] Sent: Sat

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

2011-01-27 Thread Bruno Freudensprung
Hi, I finally noticed a forall keyword that might be useful (see section 5.1.4.1. Syntax of templates). Maybe can you try something like: [forall(){Option(code == $)}] Bruno. Bruno Freudensprung a écrit : Hi Gurvinder, I've just taken a look at chapter 5.1 of Drools Expert about decision

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

2011-01-27 Thread Wolfgang Laun
2011/1/27 Bruno Freudensprung bruno.freudenspr...@temis.com Hi, I finally noticed a forall keyword that might be useful (see section 5.1.4.1. Syntax of templates). Maybe can you try something like: [forall(){Option(code == $)}] This must be written as forall(){Option(code == $)} so

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

2011-01-26 Thread groovenarula
Thanks for outlining the approach, Edson. Unfortunately, I'm a newbie using drools, so I just need some clarification on what you mean by 'matchAll is your own accumulate function with the semantics you described.' ? Do you mean that I have to create a 'custom' accumulate function ? Edson, if

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

2011-01-26 Thread Wolfgang Laun
Accumulate functions are very well documented in the Expert manual. Look for a section titled Accumulate Functions. You could also use accumulate with all the steps in inline code, which is documented in the preceding section. -W On 26 January 2011 16:50, groovenarula gnaru...@la-z-boy.com

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

2011-01-26 Thread groovenarula
Thanks Wolfgang. I found it. I Work on it and let you'll know how it goes. Sent from my iPhone On Jan 27, 2011, at 1:08 AM, Wolfgang Laun-2 [via Drools - Java Rules Engine] ml-node+2356705-1292265879-9...@n3.nabble.com wrote: Accumulate functions are very well documented in the Expert

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

2011-01-26 Thread Edson Tirelli
I suggest you use this as a base for your implementation, as I think it will help you: https://github.com/droolsjbpm/droolsjbpm/blob/master/drools-core/src/main/java/org/drools/base/accumulators/CollectSetAccumulateFunction.java

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

2011-01-26 Thread groovenarula
Edson, This surely looks like a great template to base my implementation - it looks like an great starting point. Gurvinder -Original Message- From: Edson Tirelli-4 [via Drools - Java Rules Engine] [mailto:ml-node+2359987-1512063982-9...@n3.nabble.com] Sent: Wed 1/26/2011 11:44 PM

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

2011-01-24 Thread Bruno Freudensprung
Hi Gurvinder, I've just taken a look at chapter 5.1 of Drools Expert about decision tables but I've been unable to find out how to do that. If you find a solution, could you please post it here? I'm pretty sure I will need that as well ;-). Best regards, Bruno. groovenarula a écrit : Thanks

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

2011-01-24 Thread Edson Tirelli
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(),

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

2011-01-21 Thread groovenarula
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.

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

2011-01-20 Thread groovenarula
Hello, I have a fact called 'Option' : public class Option { private String code; private Item item; public String getCode() { return code; } public void setCode(String optionCode) { this.code = optionCode; } At

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

2011-01-20 Thread Wolfgang Laun
I understand this so that there must be *exactly* 2 Option facts, and therefore: $o1: Option (code == P1) $o2: Option (code == P2) not Option( this != $o1, this != $o2 ) On 20 January 2011 14:33, Bruno Freudensprung bruno.freudenspr...@temis.com wrote: Hello, Maybe could you try the