Re: [rules-users] rule fires while condition is false

2010-05-06 Thread miguel machado
Hi there,

er.. why don't you remove your eval and just evaluate in the object
binding?

$var = TypeOfObject( netRepaymentAmountAbilityIncludingLiabilities = 0.65)

Other than that, i don't think a lotta people are still using drools4 and i
have no idea why that is happening. Apparently, it makes no sense :-/
_ miguel


On Thu, May 6, 2010 at 5:53 AM, Shai Bentin s...@centimia.com wrote:

 I'm running drools 4. It has been running for a long time with no issues.

 I have this weird issue now and I'm wondering what can explain this.

 I have the following rule defined.

 rule netRepaymentWithLiabilities1
 agenda-group autoUnderwriting
 when
 #conditions
 enrichedApplication: EnrichedApplicationVersionTO()
 eval
 (enrichedApplication.getNetRepaymentAmountAbilityIncludingLiabilities()
 = 0.65)
 decision: Decision()
 then
 #actions
 System.out.println(!!  +
 (enrichedApplication.getNetRepaymentAmountAbilityIncludingLiabilities()
 = 0.65));
 decision.setDecision(APPROVED, NetRepaymentWthLiblt);
 end

 This rule invokes although
 'enrichedApplication.getNetRepaymentAmountAbilityIncludingLiabilities()'
   1.
 More over in the then part it prints 'false', so how come it invoked
 while the condition is not fulfilled? What can cause this?

 Shai



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




-- 
To understand what is recursion you must first understand recursion
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] rule fires while condition is false

2010-05-06 Thread Jared Davis
Could the rules be changing the values outside of a modify block?



Please try this (untested) rule as a test. 

It binds the value on the left hand side.


 rule netRepaymentWithLiabilities1TEST
  agenda-group autoUnderwriting
  when
  ea: EnrichedApplicationVersionTO(amount :  
netRepaymentAmountAbilityIncludingLiabilities
 = 0.65)
  decision: Decision()
  then
  System.out.println(!!!  + amount + 
   !!!  + 
  ea.getNetRepaymentAmountAbilityIncludingLiabilities() );
  decision.setDecision(APPROVED, NetRepaymentWthLiblt);
 end



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


Re: [rules-users] rule fires while condition is false

2010-05-06 Thread Shai Bentin
Thanks,

I did this and saw that 'amount' was 0, although netRepayment was 
1.04, after looking at it a bit further I found the problem.

When I create the workspace I insert EnrichedApplicationVersion, I run 
some rules from a different agenda and then I cleared the agenda 
(however did not retract the enrichedApplication).
I then do some more things and insert the value of NetRepayment value to 
the EnrichedApplication, I re insert it to the workspace and then I run 
the rules.
It seems that drools did not re evaluate the EnrichedApplication again 
and thus the value of NetRepayement as fas as it was concerned was 0.

retracting EnrichedApplication or creating a new workspace solves this 
problem.

Thanks.

Shai

בתאריך 06/05/10 17:13, ציטוט Jared Davis:
 Could the rules be changing the values outside of a modify block?



 Please try this (untested) rule as a test.

 It binds the value on the left hand side.


   rule netRepaymentWithLiabilities1TEST
agenda-group autoUnderwriting
when
ea: EnrichedApplicationVersionTO(amount :
  netRepaymentAmountAbilityIncludingLiabilities
   = 0.65)
decision: Decision()
then
System.out.println(!!!  + amount +
 !!!  +
ea.getNetRepaymentAmountAbilityIncludingLiabilities() );
decision.setDecision(APPROVED, NetRepaymentWthLiblt);
   end



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


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


Re: [rules-users] rule fires while condition is false

2010-05-06 Thread Jared Davis


Shai wrote:
 
 --snip--
 I then do some more things and insert the value of NetRepayment value to 
 the EnrichedApplication, I re insert it to the workspace and then I run 
 the rules.
 It seems that drools did not re evaluate the EnrichedApplication again 
 and thus the value of NetRepayement as fas as it was concerned was 0.
 --snip--
 

For the rules engine to re-evaluate objects, you need to tell it when they
change. Even though the NetRepayment fact was updated in the engine, there
is no link defined in the rules engine between it and the
EnrichedApplication.  I'm assuming the calculation method
getNetRepaymentAmountAbilityIncludingLiabilities() uses this value.

Perhaps it would be worth investigating moving the method implementation to
a rule. If not, ensure that all object/variables used in the method do not
change once the EnrichedApplication is inserted. 


-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/rule-fires-while-condition-is-false-tp780685p781431.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] rule fires while condition is false

2010-05-06 Thread miguel machado
I think you need to use modify for that to happen. Otherwise, it doesn't
get re-evaluated. Or maybe it did, but you're using the no-loop /
lock-on-active attributes.

_ miguel



On Thu, May 6, 2010 at 3:51 PM, Shai Bentin s...@centimia.com wrote:

 It seems that drools did not re evaluate the EnrichedApplication again
 and thus the value of NetRepayement as fas as it was concerned was 0.




-- 
To understand what is recursion you must first understand recursion
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] rule fires while condition is false

2010-05-05 Thread Shai Bentin
I'm running drools 4. It has been running for a long time with no issues.

I have this weird issue now and I'm wondering what can explain this.

I have the following rule defined.

rule netRepaymentWithLiabilities1
 agenda-group autoUnderwriting
 when
 #conditions
 enrichedApplication: EnrichedApplicationVersionTO()
 eval 
(enrichedApplication.getNetRepaymentAmountAbilityIncludingLiabilities() 
= 0.65)
 decision: Decision()
 then
 #actions
 System.out.println(!!  + 
(enrichedApplication.getNetRepaymentAmountAbilityIncludingLiabilities() 
= 0.65));
 decision.setDecision(APPROVED, NetRepaymentWthLiblt);
end

This rule invokes although 
'enrichedApplication.getNetRepaymentAmountAbilityIncludingLiabilities()' 
  1.
More over in the then part it prints 'false', so how come it invoked 
while the condition is not fulfilled? What can cause this?

Shai



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