[rules-users] Question / problem

Wolfgang Laun wolfgang.laun at gmail.com
Thu May 12 05:12:10 EDT 2011


You must notify the inference engine that a fact has changed.

  modify( $testDrools ){ setMyValue("1") }

or some other way. Please check the documentation ("Expert"), section "The
Right Hand Side (then)" and other places.

-W



2011/5/12 Nico ROEDERER <ino.nicolas at gmail.com>

>  Hi,
>
> I've got a little question. I've got a drl file which contains two rules :
>
> rule "FirstRule"
>     salience 99
>     when
>         $testDrools : TestDroolsDto()
>         eval ( 1 == 1 )
>     then
>         System.out.println("Set my value to 1");
>         $testDrools.setMyValue("1");
>
> end
>
> rule "SecondRule"
>     salience 1
>     when
>         $testDrools : TestDroolsDto()
>         eval( $testDrools.getMyValue().equals("") )
>     then
>         System.out.println("My Value : " + $testDrools.getMyValue() );
> end
>
> Is it normal that in my second rule is verified ?
> -> eval( $testDrools.getMyValue().equals("") ) is true
> but : System.out.println("My Value : " + $testDrools.getMyValue() ); show
> me that myValue == 1
>
> Perhaps I did something wrong ?
>
> Thanks for your helping me.
> N.
>
>
>
> PS : Here is me TestDroolsDto :
> public class TestDroolsDto {
>     private String myValue;
>
>     public TestDroolsDto() {
>         myValue="";
>     }
>
>     public String toString() {
>         return " --> " + myValue;
>     }
>
>     /**
>     * @return the myValue
>     */
>    public String getMyValue() {
>        if ( myValue == null ) {
>            myValue = "";
>        }
>        return myValue;
>    }
>
>     /**
>     * @param myValue the myValue to set
>     */
>    public void setMyValue( String myValue ) {
>        this.myValue = myValue;
>    }
> }
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110512/b8566ebd/attachment.html 


More information about the rules-users mailing list