[rules-users] how to use only updated value in drools
I am having a drl file with 2 rules The 1st rule updates a attribute, say updates attribute b to 10 based on some condition. The 2nd rule has a check for values with b not equal to 10. It logs error for those values not equals to 10. The b value gets updated to 10 in rule 1. However in the second rule it does not use updated value and logs error. Is there a way to use the updated b value in the 2nd rule. I tried using modify but still the error gets logged. -- View this message in context: http://drools.46999.n3.nabble.com/how-to-use-only-updated-value-in-drools-tp4017626.html Sent from the Drools: User forum 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] how to use only updated value in drools
what is the initial value of b ? what are the salience of your rules ? and why not posting your rules directly ? - Original Message - From: learner anandbabu6...@yahoo.com To: rules-users@lists.jboss.org Sent: Mardi 29 Mai 2012 12:29:28 Subject: [rules-users] how to use only updated value in drools I am having a drl file with 2 rules The 1st rule updates a attribute, say updates attribute b to 10 based on some condition. The 2nd rule has a check for values with b not equal to 10. It logs error for those values not equals to 10. The b value gets updated to 10 in rule 1. However in the second rule it does not use updated value and logs error. Is there a way to use the updated b value in the 2nd rule. I tried using modify but still the error gets logged. -- View this message in context: http://drools.46999.n3.nabble.com/how-to-use-only-updated-value-in-drools-tp4017626.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ 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] how to use only updated value in drools
can u please share ur drl file? On Tue, May 29, 2012 at 4:05 PM, Vincent LEGENDRE vincent.legen...@eurodecision.com wrote: what is the initial value of b ? what are the salience of your rules ? and why not posting your rules directly ? - Original Message - From: learner anandbabu6...@yahoo.com To: rules-users@lists.jboss.org Sent: Mardi 29 Mai 2012 12:29:28 Subject: [rules-users] how to use only updated value in drools I am having a drl file with 2 rules The 1st rule updates a attribute, say updates attribute b to 10 based on some condition. The 2nd rule has a check for values with b not equal to 10. It logs error for those values not equals to 10. The b value gets updated to 10 in rule 1. However in the second rule it does not use updated value and logs error. Is there a way to use the updated b value in the 2nd rule. I tried using modify but still the error gets logged. -- View this message in context: http://drools.46999.n3.nabble.com/how-to-use-only-updated-value-in-drools-tp4017626.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
Thanks for the reply. Please find a basic structure of my drl file rule set b value salience 10 no-loop when e : Person(b == ); then e.setB(10); end rule b other than 10 salience 1 no-loop when e : Person(b != 10) then System.out.println(error+e.getB()); end -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017633.html Sent from the Drools: User forum 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] how to use only updated value in drools
learner wrote Thanks for the reply. Please find a basic structure of my drl file rule set b value salience 10 no-loop when e : Person(b == ); then //use this to get value in an another rule e.setB(10); insert(e); end rule b other than 10 salience 1 no-loop when e : Person(b != 10) then System.out.println(error+e.getB()); end -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017634.html Sent from the Drools: User forum 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] how to use only updated value in drools
I tried using insert but still the issue persists -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017635.html Sent from the Drools: User forum 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] how to use only updated value in drools
use update(e); On Tue, May 29, 2012 at 4:42 PM, learner anandbabu6...@yahoo.com wrote: I tried using insert but still the issue persists -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017635.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ 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] how to use only updated value in drools
When I use update the message appears twice. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017638.html Sent from the Drools: User forum 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] how to use only updated value in drools
Datatype of b is String -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017639.html Sent from the Drools: User forum 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] how to use only updated value in drools
second rule condition is wrong b is a string it seems to be. then it should be e : Person(b != 10) -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017640.html Sent from the Drools: User forum 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] how to use only updated value in drools
String b should be compare using 10 try with this On Tue, May 29, 2012 at 12:19 PM, bharadwaj2012 bharadwaj2...@gmail.comwrote: second rule condition is wrong b is a string it seems to be. then it should be e : Person(b != 10) -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017640.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- cheers Sumatheja Dasararaju ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
Modifying the condition does not fix the issue It seems even though the value of b was modified to 10 in the first rule. It considers b as only blank (initial value) in the When clause of second rule.However in sysout the value of b appears properly as 10 -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017641.html Sent from the Drools: User forum 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] how to use only updated value in drools
Are you sure the first rule is fired? I tried out a similar program locally and it works fine. If the first rule is fired and you are updating the fact in the consequence of first rule, then certainly the second rule wont be fired. On Tue, May 29, 2012 at 12:23 PM, learner anandbabu6...@yahoo.com wrote: Modifying the condition does not fix the issue It seems even though the value of b was modified to 10 in the first rule. It considers b as only blank (initial value) in the When clause of second rule.However in sysout the value of b appears properly as 10 -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017641.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- cheers Sumatheja Dasararaju ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
Please post the *current* state of your rules. Too much line noise, not sure what you have now :-{ -W On 29/05/2012, learner anandbabu6...@yahoo.com wrote: Modifying the condition does not fix the issue It seems even though the value of b was modified to 10 in the first rule. It considers b as only blank (initial value) in the When clause of second rule.However in sysout the value of b appears properly as 10 -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017641.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ 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] how to use only updated value in drools
Please find a basic structure of my drl file rule set b value salience 10 no-loop when e : Person(b == ); then e.setB(10); end rule b other than 10 salience 1 no-loop when e : Person(b != 10) then System.out.println(error+e.getB()); end The problem is the sysout gets printed in rule 2 , but it should not as the value of b is modified to 10 in 1st rule -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017647.html Sent from the Drools: User forum 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] how to use only updated value in drools
you just use update in first rule it's works perfeclty you'll get only one sysout printed. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017648.html Sent from the Drools: User forum 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] how to use only updated value in drools
On 29/05/2012, learner anandbabu6...@yahoo.com wrote: Please find a basic structure of my drl file rule set b value salience 10 no-loop when e : Person(b == ); then ## e.setB(10); modify( e ){ setB( 10 ) } Otherwise the Engine doesn't know about the change. Read the Expert manual - this is fundamental. -W end rule b other than 10 salience 1 no-loop when e : Person(b != 10) then System.out.println(error+e.getB()); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
But since the b value is updated to 10 , is there a way to use this updated value in second rule and not print any sysout. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017650.html Sent from the Drools: User forum 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] how to use only updated value in drools
use update(e) in first rule man then u can get the updated value in second rule for sure. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017651.html Sent from the Drools: User forum 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] how to use only updated value in drools
Use of modify fixed the issue. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017652.html Sent from the Drools: User forum 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] how to use only updated value in drools
rule set b value salience 10 no-loop when e : Person(b == ); then e.setB(10); update(e); end rule b other than 10 salience 1 no-loop when e : Person(b != 10) then System.out.println(error+e.getB()); end see this code here first rule will get fire b=10 sencod rule will not match since b=10 or if u want to get the updated value in secnond rule e : Person(b == 10) -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017653.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users