[rules-users] accessing a drools variable

Wolfgang Laun wolfgang.laun at gmail.com
Thu Nov 4 15:17:33 EDT 2010


To set a global called "prodName" to the value returned by getName() within
a rule's consequence you should use
   drools.getWorkingMemory().setGlobal( "prodName",  getName() );
-W

On 4 November 2010 18:15, rajivharris <rajivharris at gmail.com> wrote:

>
> Hi,
> I am setting a String variable as global. And trying the access the same in
> my Java program. Can anyone help on how to do this.
>
> code snippet:
> global String prodName;
>
> rule "Your First Rule"
>
>        when
>                #conditions
>                eval (true)
>        then
>                #actions
>                prodName= getName();
>                System.out.println( "name:" +prodName);
>
> end
>
> Thanks,
> Rajiv.
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/accessing-a-drools-variable-tp1843203p1843203.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> 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/20101104/b0e7e4f6/attachment.html 


More information about the rules-users mailing list