[rules-users] How to define static constant variable

Welsh, Armand AWelsh at StateStreet.com
Tue Nov 22 16:59:40 EST 2011


I have a similar issue. I use sqlDefaultDate() and maxDate() in several of my rules.  What I did was to create a static function for each.  Each function simply returns a static variable.  The variable is initialized on first use.  This ensure maxium performance.  Then in my rules, I just put the function name in my DRL file where ever I need it referenced.  But I also made sure to import external function in my imports statements to make the function available to my applications.

-----Original Message-----
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Zhao Yi
Sent: Tuesday, November 22, 2011 5:59 AM
To: rules-users at lists.jboss.org
Subject: Re: [rules-users] How to define static constant variable

There are some constant variables will be used in rules. For example, I have a maximum and minimum value which are used to limited other values. So I need to define these values in rules. If I set global variable, I have to set these global on the session in java code. How can I set them in rules without change Java code?

--
View this message in context: http://drools.46999.n3.nabble.com/How-to-define-static-constant-variable-tp3527416p3527761.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