You must notify the inference engine that a fact has changed.<br><br> modify( $testDrools ){ <font size="-1">setMyValue("1") }<br><br>or some other way. Please check the documentation ("Expert"), section "The Right Hand Side (then)" and other places.<br>
<br>-W<br></font><br><br><br><div class="gmail_quote">2011/5/12 Nico ROEDERER <span dir="ltr"><<a href="mailto:ino.nicolas@gmail.com">ino.nicolas@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div text="#000000" bgcolor="#ffffff">
<font size="-1">Hi,<br>
<br>
I've got a little question. I've got a drl file which contains two
rules :<br>
<br>
rule "FirstRule"<br>
salience 99<br>
when<br>
$testDrools : TestDroolsDto() <br>
eval ( 1 == 1 )<br>
then <br>
System.out.println("Set my value to 1");<br>
$testDrools.setMyValue("1");<br>
<br>
end<br>
<br>
rule "SecondRule"<br>
salience 1<br>
when<br>
$testDrools : TestDroolsDto() <br>
eval( $testDrools.getMyValue().equals("") )<br>
then <br>
System.out.println("My Value : " +
$testDrools.getMyValue() );<br>
end<br>
<br>
Is it normal that in my second rule is verified ? <br>
-> </font><font size="-1"> eval(
$testDrools.getMyValue().equals("") ) is true<br>
but : </font><font size="-1"> System.out.println("My Value : " +
$testDrools.getMyValue() ); show me that myValue == 1 <br>
<br>
Perhaps I did something wrong ?<br>
<br>
Thanks for your helping me.<br>
N.<br>
<br>
</font><font size="-1"><br>
<br>
PS : Here is me TestDroolsDto :<br>
public class TestDroolsDto {<br>
private String myValue;<br>
<br>
public TestDroolsDto() {<br>
myValue="";<br>
}<br>
<br>
public String toString() {<br>
return " --> " + myValue;<br>
}<br>
<br>
/**<br>
* @return the myValue<br>
*/<br>
public String getMyValue() {<br>
if ( myValue == null ) {<br>
myValue = "";<br>
}<br>
return myValue;<br>
}<br>
<br>
/**<br>
* @param myValue the myValue to set<br>
*/<br>
public void setMyValue( String myValue ) {<br>
this.myValue = myValue;<br>
}<br>
}<br>
<br>
</font>
</div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>