[rules-users] [rule-users]how to create object properties in single stmnt

Sikkandar Nawabjan Sikkandar.Nawabjan at ustri.com
Sat May 19 05:31:01 EDT 2007


Hi ,
The very reason i used to compare two object reference is that i got then executed multiple time when i do duplicate check between object properties. so i beleive the pattern match happen more than a time
for example
 when
     $obj1:object($code:code,$stdate:startdate);
     $obj2:object(code==$code,startdate=$stdate);
 then
if(obj1!=obj2)
     System.out.println("Fired");

My questions are 

1) In 3.0.6 is there any other way to avoid this multiple check other than using eval(which affects performance i beleive). i can't use this operator in 3.0.6

2) related to this i have one more query. how to check properties within the object itself

for example i want to do

 when
     $obj1:object($code:code,$stdate:startdate,$enddate:enddate > $stdate, reasoncode == $code);
 then
     System.out.println("Fired");
i beleive the above throws error in 3.0.6 (nullpointer related to alpha node)
 
Earlier reply is highly appreciated
 
Thanks and Regs,
Bassha

 

 


 
 
 
 
 
 
----------------------------------------------------------------------

Message: 1
Date: Fri, 18 May 2007 09:51:34 -0300
From: "Edson Tirelli" <tirelli at post.com>
Subject: Re: [rules-users] how to check reference
To: "Rules Users List" <rules-users at lists.jboss.org>
Message-ID:
        <e6dd5ba30705180551y6562b7f6oe5ea173379ebb4c8 at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

   Yes, in 3.0.6 you will need eval. But also it is important to remember
that by default, in 3.0.6, an object will never match more than one pattern.
So in the given example, ob1 and ob2 will always be different and the check
is not needed.
   In 4.0, things are a bit different, as by default a single object may
match more than one pattern at once and we introduced the "this" keyword to
check for object identity.

   []s
   Edson


2007/5/18, Chris Woodrow <woodrow.chris at gmail.com>:
>
> Hi,
> You can use eval();
>
> when
>     $obj1:object();
>     $obj2:object();
>     eval ($obj1!=$obj2);
> then
>     System.out.println("Fired");
>
> Hope this helps
> Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070519/ae588f30/attachment.html 


More information about the rules-users mailing list