[rules-users] Globals in LHS

2010-07-16 Thread Meeraj Kunnumpurath
Hi, Can I use globals in the LHS of a rule. The rule I have is as follows, package mypackage; import mypackage.Payment; global java.util.Set accountNumbers; rule Check debtor account number exists when $p : Payment (accountNumber not memberOf $accountNumbers) then end I insert an

[rules-users] Globals in LHS

2008-06-27 Thread thomas kukofka
Hello, Is it possible to evaluate a global on the LHS of rule? Like: global SomeGlobal someGlobal rule xy when someGlobal.getValue() = 3 then end Kind Regards Thomas ___ rules-users mailing list

Re: [rules-users] Globals in LHS of a rule?

2007-11-28 Thread Michael Zimmermann
Mark Proctor wrote: you would have to do List() from myList, otherwise it assumes its reasoning over data asserted into the working memory - hmm I assume that works, never tried, as I'm not sure its a valid use case - just assert the object. You can use globals freely in field constraints.

[rules-users] Globals in LHS of a rule?

2007-11-27 Thread Michael Zimmermann
Hi there, according to the online documentation globals are supported in the LHS of a rule, yet requires a bit of care to use there. But how do I use globals in the LHS? Is there any option to access a globals variable directly like: globals List myList rule SomeRule when myList.size() == 2

Re: [rules-users] Globals in LHS of a rule?

2007-11-27 Thread Darko IVANCAN
Try this: Global java.util.List myList rule SomeOtherRule when myList(size==2); then ... end Doe not seem to be a global problem, but rather a syntax issue. hope this helps, Darko Ivancan On 27/11/2007 14:40, Michael Zimmermann wrote: Hi there, according to the online documentation

Re: [rules-users] Globals in LHS of a rule?

2007-11-27 Thread Michael Zimmermann
Hi Darko, Global java.util.List myList rule SomeOtherRule when myList(size==2); then ... end Sorry, won't work. Unable to resolve object type 'diameters'. What works though is: rule abc when eval (diameters.size() == 2) then ... end cu, Michael

Re: [rules-users] Globals in LHS of a rule?

2007-11-27 Thread Darko IVANCAN
Hmm, Right. Size is not a property (getSize), thus (size==2) does not work. I'm not sure,but myList(size()==2) could work though. Does it ? darko On 27/11/2007 15:09, Michael Zimmermann wrote: Hi Darko, Global java.util.List myList rule SomeOtherRule when myList(size==2);

Re: [rules-users] Globals in LHS of a rule?

2007-11-27 Thread Michael Zimmermann
Darko IVANCAN wrote: I'm not sure,but myList(size()==2) could work though. Does it ? No, doesn't work. My interpreation so far: a) globals are only possible in eval() statements b) access to methods of global variables are not supported. and possibly c) only properties of globals can be

Re: [rules-users] Globals in LHS of a rule?

2007-11-27 Thread Mark Proctor
Michael Zimmermann wrote: Darko IVANCAN wrote: I'm not sure,but myList(size()==2) could work though. Does it ? No, doesn't work. My interpreation so far: a) globals are only possible in eval() statements they are valid in evals, inlined evals(previous called predicates),

Re: [rules-users] Globals in LHS of a rule?

2007-11-27 Thread Mark Proctor
Michael Zimmermann wrote: Darko IVANCAN wrote: I'm not sure,but myList(size()==2) could work though. Does it ? No, doesn't work. My interpreation so far: a) globals are only possible in eval() statements b) access to methods of global variables are not supported. and possibly c)

Re: [rules-users] Globals in LHS of a rule?

2007-11-27 Thread Darko IVANCAN
Hi, In fact I had the same idea when java.util.List(size()==2) from myList; then ... But I didn't believe it'll be needed. Thanks for the confirmation, Darko Ivancan On 27/11/2007 17:20, Mark Proctor wrote: Darko IVANCAN wrote: Hmm, Right. Size is not a property (getSize), thus (size==2)