You can use:
- a fully qualified public static field, e.g. salience ( (int)java.lang.Math.PI )
- a DRL-defined function, e.g. function int FOO(){ return 10; } ... salience( FOO() )
- a global, e.g. global Integer foo; ... salience ( foo ). But initialisation is clumsy and not checked by a compiler.
- any field from any fact.
You can NOT use a static field imported with a "start" pathname, e.g., import function com.acme.*.
-W
On 4 May 2011 11:34, Swindells, Thomas <TSwindells@nds.com> wrote:
> Salience can be defined using expressions - so have you tried it?
> If referencing a static constant (perhaps in a java class) doesn't work you could try a global,
> if that doesn't work try defining a function call which returns the desired value, if that doesn't work you could add an extra fact containing the value, bind the value to the variable and then use that variable for the salience.
>
> Once you've tried it let us know which ways do/don't work!
>
> Thomas
>
> -----Original Message-----
> From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of alebu
> Sent: Wednesday, May 04, 2011 9:10 AM
> To: rules-users@lists.jboss.org
> Subject: [rules-users] Using constant for salience instead of hardcoded values?
>
> Hi all,
> Is it possible to use a constant for salience instead of hardcoded value? It have a sence when you have many rules and only several salience level. They maybe more descriptive like START, VALIDATION, etc and easier to maintain in the future. If it not possible right now, then maybe it worth to request like feature request in the future?
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> **************************************************************************************
> This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.
>
> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
> **************************************************************************************
>
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>