Hi Edson, thanks for your answer.

I don't know who's responsible for the suggestion box in Eclipse. I'm attaching 2 files: GlobalVariable.drl is the test DRL, and the PNG file is the result of pressing Ctrl+space between "logger" and the period sign. Even though using logger inside the funcion is marked as an error, the global variable appears in the suggestion box.

I'm using Eclipse Europa (Version: 3.3.0, Build id: I20070621-1340), and Drools eclipse plugin v4.0.4.

If you need any more info, feel free to contact me.

Regards,
José Arrarte

-------- Original Message --------
Subject: Re:[rules-users] Using global variables in functions
From: Edson Tirelli <[EMAIL PROTECTED]>
To: Rules Users List <[email protected]>
Date: jueves, 17 de abril de 2008 17:37:01

   Not at this moment.

   []s
   Edson

2008/4/17 José Arrarte <[EMAIL PROTECTED]>:
Hello all,

Is there a way I can use a global variable inside a function definition without having to pass it as a parameter?

I'd like to be able to use a log4j Logger instance (declared as a global variable) inside functions.

Best regards,
José Arrarte

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users



--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com

_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users




<<inline: GlobalVariableInSuggestion.png>>

package com.sample

import java.math.BigDecimal;

global org.apache.log4j.Logger logger;

rule "using globan in function"
        when
                eval( aFunction( ) );
        then
                logger.info("OK!");
end

function boolean aFunction() {
        logger.info("logger showed as suggestion!");
        
        return true;
}
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to