Is there an easy way to access information about the currently executing
rule (e.g. Name, salience, group) within a rule consequence? E.g.
rule "Sample Rule"
salience = 100
when
$v : Fact(name == "Test")
then
System.out.println("The currently executing rule is " +
<???>.getName());
end
I could copy the name into the print but of course then I have it in two
places I need to keep in sync. I know I can get the full log but that's
not what I'm interested in.
-Russ
Show replies by date
There is an implicit KnowledgeHelper object called "drools" available in the
RHS.
drools.getRule().getName() will provide what you need.
_____
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of
rrogers(a)us.imshealth.com
Sent: 11 April 2008 16:04
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Access to currently executing rule in consequence?
Is there an easy way to access information about the currently executing
rule (e.g. Name, salience, group) within a rule consequence? E.g.
rule "Sample Rule"
salience = 100
when
$v : Fact(name == "Test")
then
System.out.println("The currently executing rule is " +
<???>.getName());
end
I could copy the name into the print but of course then I have it in two
places I need to keep in sync. I know I can get the full log but that's not
what I'm interested in.
-Russ