Inside eval() you write plain java code, where == is the identity operator. When you write constraints, you are using DRL language where == calls .equals() method behind the scenes.

   []s
   Edson

2009/8/3 Shah, Malay <Malay.Shah@morganstanley.com>
Minor correction in the rule:
 
The eval block is:
 
eval(lastCapacity == null && entityOid == parentOid && msgType == "8")
 
instead of
 
eval(lastCapacity != null && entityOid == parentOid && msgType == "8")

Any help is much appreciated.
 
Thanks
 
Malay Shah
 


From: Shah, Malay (IDEAS)
Sent: Monday, August 03, 2009 4:18 PM
To: rules-users@lists.jboss.org
Subject: Question on eval block

Hi,
 
I am trying to use eval block in one of the rules and am a bit confused about it. The rule is something like this:
 

rule "LastCapacity"
when
    e: Execution(lastCapacity:lastCapacity,parentOid:parentOid)
    eo: ExecutionOrder(entityOid:entityOid,msgType:msgType,execType:execType)
    eval(lastCapacity  != null && entityOid == parentOid && msgType == "8")
then

..................
end

where Execution and ExecutionOrder are 2 objects that are linked by an ID. I expect eval to return true for certain sets of objects that I send. But, the above rule exits without running the consequence. On the other hand, when I write the rule as:

 rule "LastCapacity"
when
    e: Execution(lastCapacity:lastCapacity==null,parentOid:parentOid)
    eo: ExecutionOrder(entityOid:entityOid == parentOid, msgType == "8")
then

.............................
end

the rule triggers the consequence for same set of objects. I thought that if the expression in eval block comes out to be true, the consequence will be triggered. Am I missing something obvious here?
 
Thanks
 
Malay Shah

NOTICE: If received in error, please destroy, and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. We may monitor and store emails to the extent permitted by applicable law.


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com