[rules-users] How to insert values into drl

Wolfgang Laun wolfgang.laun at gmail.com
Tue Dec 10 01:29:24 EST 2013


Can we be sure that the rule fires? (println on the RHS?)
-W

On 09/12/2013, anjana.ackroyd <anjana.ackroyd at gmail.com> wrote:
>
> Thanks. Now when I do a get on Message I get a null value. I was under the
> assumption that the drl n.setMessage is setting the value for message
>
>   FactType factType =
> runner.buildFactType("org.drools.test","NumberCompare") ;
>         Object nc = factType.newInstance();
>         factType.set( nc, "numberone",Integer.valueOf( 42 ));
>         factType.set( nc, "numbertwo", Integer.valueOf( 42 ) );
>         kieSession.insert(nc);
>         runner.fireAllRules();
>         System.out.println(factType.get(nc,"message"));--------------> is
> null
>
>
>
>
> In the DRL
>
>
> declare NumberCompare
>     message : String
>     numberone: Integer
>     numbertwo: Integer
> end
>
> rule "numberone is equals to numbertwo"
>     when
>         n: NumberCompare(numberone == numbertwo);
>
>     then
>         n.setMessage("numberone is equals to numbertwo");
>
> end
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-insert-values-into-drl-tp4027151p4027177.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list