The RHS of the rule uses Java syntax, so you need to declare all vars. You
need to declare "rulename" as a String.
Scott Burrows
407-739-7752
On Wed, Jul 2, 2008 at 5:09 PM, Marina <ppine7(a)yahoo.com> wrote:
Hello,
I need to know the rule name of the rule that fired in the consequence part
of the rule. I tried something like the following, just trying to see if I
can get it this way:
package mode.simple;
import java.lang.String;
import java.util.List;
import com.emptoris.ecm.domain.ContractRulesData;
global java.util.Set approverList;
rule "testOR_1"
dialect "java"
when
$data : ContractRulesData (sum > 500 || name matches ".*important")
then
approverList.add("approver3, approver4, Level5");
ruleName = drools.getRule().getName();
System.out.println(ruleName + " is TRUE");
end
When I'm trying to compile the rule, I'm getting the following error:
Builder errors:
Rule Compilation error : [Rule name=testOR_1, agendaGroup=MAIN, salience=0,
no-loop=false]
mode/simple/Rule_testOR_1_0.java (8:391) : ruleName cannot be resolved
mode/simple/Rule_testOR_1_0.java (9:452) : ruleName cannot be resolved
java.lang.RuntimeException: Unable to compile rules file: testOR_1.drl
I must be doing something wrong here... ?
thanks!
Marina
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users