[rules-users] accessing a drools variable

Bruno Freudensprung bruno.freudensprung at temis.com
Thu Nov 4 13:58:24 EDT 2010


Hi,

I've never tried this but there is a getGlobals() method on the 
StatelessKnowledgeSession and on the StatefulKnowledgeSession (actually 
on KnowledgeRuntime).
Maybe worth giving a try :-).
Best regards,

Bruno.

rajivharris a écrit :
> 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.
>   




More information about the rules-users mailing list