[rules-users] How to insert values into drl

anjana.ackroyd anjana.ackroyd at gmail.com
Mon Dec 9 17:26:03 EST 2013


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.


More information about the rules-users mailing list