<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=906191215-11042008><FONT face=Arial
color=#0000ff size=2>There is an implicit KnowledgeHelper object called "drools"
available in the RHS.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=906191215-11042008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=906191215-11042008><FONT face=Arial
color=#0000ff size=2>drools.getRule().getName() will provide what you
need.</FONT></SPAN></DIV><FONT face=Arial color=#0000ff size=2></FONT><BR>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of
</B>rrogers@us.imshealth.com<BR><B>Sent:</B> 11 April 2008 16:04<BR><B>To:</B>
rules-users@lists.jboss.org<BR><B>Subject:</B> [rules-users] Access to
currently executing rule in consequence?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2>
<DIV><SPAN class=366074314-11042008><FONT face=Arial size=2>Is there an easy
way to access information about the currently executing rule (e.g. Name,
salience, group) within a rule consequence? E.g.</FONT></SPAN></DIV>
<DIV><SPAN class=366074314-11042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=366074314-11042008><FONT face=Arial size=2>rule "Sample
Rule"</FONT></SPAN></DIV>
<DIV><SPAN class=366074314-11042008> <FONT face=Arial
size=2>salience = 100</FONT></SPAN></DIV>
<DIV><SPAN class=366074314-11042008><FONT face=Arial
size=2>when</FONT></SPAN></DIV>
<DIV><SPAN class=366074314-11042008>
<FONT face=Arial size=2>$v : Fact(name == "Test")</FONT></SPAN></DIV>
<DIV><SPAN class=366074314-11042008><FONT face=Arial
size=2>then</FONT></SPAN></DIV>
<DIV><SPAN class=366074314-11042008> <FONT face=Arial
size=2>System.out.println("The currently executing rule is " +
<???>.getName());</FONT></SPAN></DIV>
<DIV><SPAN class=366074314-11042008><FONT face=Arial
size=2>end</FONT></SPAN></DIV>
<DIV><SPAN class=366074314-11042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=366074314-11042008><FONT face=Arial size=2>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. </FONT></SPAN></DIV>
<DIV><SPAN class=366074314-11042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=366074314-11042008><FONT face=Arial
size=2>-Russ</FONT></SPAN></DIV></FONT></DIV></BLOCKQUOTE></BODY></HTML>