<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.6082" name=GENERATOR>

<DIV dir=ltr align=left><SPAN class=048194609-01062011><FONT face=Arial 
color=#0000ff size=2>I get this exception:</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2>Exception in thread "main" 
org.drools.runtime.rule.ConsequenceException: rule: RFI1</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2>&nbsp;at 
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)<BR>&nbsp;at 
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:927)<BR>&nbsp;at 
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)<BR>&nbsp;at 
org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)<BR>&nbsp;at 
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785)<BR>&nbsp;at 
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751)<BR>&nbsp;at 
org.drools.template.parser.TemplateDataListener.finishSheet(TemplateDataListener.java:121)<BR>&nbsp;at 
org.drools.template.DataProviderCompiler.finishData(DataProviderCompiler.java:100)<BR>&nbsp;at 
org.drools.template.DataProviderCompiler.processData(DataProviderCompiler.java:95)<BR>&nbsp;at 
org.drools.template.DataProviderCompiler.compile(DataProviderCompiler.java:73)<BR>&nbsp;at 
org.drools.template.ObjectDataCompiler.compile(ObjectDataCompiler.java:44)<BR>&nbsp;at 
org.drools.examples.decisiontable.TemplateParser.&lt;init&gt;(TemplateParser.java:33)<BR>&nbsp;at 
org.drools.examples.decisiontable.TemplateParser.main(TemplateParser.java:18)<BR>Caused 
by: java.lang.RuntimeException: [Error: unable to resolve method: 
java.util.HashMap.value() [arglength=0]]<BR>[Near : {... Unknown 
....}]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
^<BR>[Line: 1, Column: 0]<BR>&nbsp;at 
org.drools.template.parser.DefaultGenerator.generate(DefaultGenerator.java:73)<BR>&nbsp;at 
org.drools.template.parser.Rule_RFI1_0.defaultConsequence(Rule_RFI1_0.java:7)<BR>&nbsp;at 
org.drools.template.parser.Rule_RFI1_0DefaultConsequenceInvoker.evaluate(Rule_RFI1_0DefaultConsequenceInvoker.java:30)<BR>&nbsp;at 
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)<BR>&nbsp;... 
11 more<BR>Caused by: [Error: unable to resolve method: 
java.util.HashMap.value() [arglength=0]]<BR>[Near : {... Unknown 
....}]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
^<BR>[Line: 1, Column: 0]<BR>&nbsp;at 
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:932)<BR>&nbsp;at 
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:592)<BR>&nbsp;at 
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:311)<BR>&nbsp;at 
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:137)<BR></FONT></DIV>
<DIV dir=ltr align=left><SPAN class=048194609-01062011><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=048194609-01062011></SPAN><FONT face=Arial color=#0000ff 
size=2>My&nbsp;rule&nbsp;template&nbsp;is&nbsp;virtually&nbsp;the&nbsp;same<SPAN 
class=048194609-01062011> (name is a literal)</SPAN>:</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2>rule "</FONT><a href="/user/SendEmail.jtp?type=node&node=3010031&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a><FONT face=Arial><FONT color=#0000ff><FONT 
size=2>}"<BR>when <BR>&nbsp;$service:ServiceBean(name == "DiscountCurve", value 
== "@{value}")&nbsp;<BR>&nbsp;$riskType:RiskType()<BR>then 
<BR>&nbsp;$riskType.setName("@{type}");<BR>&nbsp;$riskType.setValue("@{<SPAN 
class=048194609-01062011>value</SPAN>}");<BR>end template<SPAN 
class=048194609-01062011></SPAN></FONT></FONT></FONT><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Wolfgang Laun-2 [via Drools] 
[mailto:<a href="/user/SendEmail.jtp?type=node&node=3010031&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a>] <BR><B>Sent:</B> 01 
June 2011 10:33<BR><B>To:</B> Mullard, Christopher<BR><B>Subject:</B> Re: 
[rules-users] Smart Templates<BR></FONT><BR></DIV>
<DIV></DIV>There is a way, provided the required information is available at the 
time the rule is created.<BR><BR>There is a detailed section in the Expert 
manual explaining how to call template expansion with either a Collection of Map 
objects or a Collection of JavaBean objects. Taking beans, you would 
have<BR><BR>ServiceBean( String name, String value )<BR>String getName<BR>String 
getValue<BR>String getType(){<BR>Â&nbsp;Â&nbsp; if( "AAA".equals( value ) ) 
return "Type1";<BR>Â&nbsp;Â&nbsp; if( "XYZ".equals( value ) ) return 
"Type2";<BR>Â&nbsp;Â&nbsp; ...<BR>}<BR><BR>You create a collection of such 
Objects, and call the expander for a template like this:<BR><BR>rule 
"DC_@{row.rowNumber}" <BR>when <BR>Â&nbsp; Â&nbsp; $service: Service(name == 
"@{service}", value == "@{value}") <BR>Â&nbsp; Â&nbsp; $riskType: RiskType() 
<BR>then <BR>Â&nbsp; Â&nbsp; $riskType.setName("@{type}"); <BR>
<DIV>Â&nbsp; Â&nbsp; $riskType.setAtt(0,"@{value}"); <BR>end 
</DIV><BR>-W<BR><BR><BR><BR>
<DIV class=gmail_quote>2011/6/1 ChrisMu <SPAN dir=ltr>&lt;<A 
href="/user/SendEmail.jtp?type=node&amp;node=3009984&amp;i=0" target=_top rel="nofollow" link="external">[hidden email]</A>&gt;</SPAN><BR>
<BLOCKQUOTE class=gmail_quote 
style="PADDING-RIGHT: 1em; PADDING-LEFT: 1em; PADDING-BOTTOM: 0px; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: #cccccc 2px solid; PADDING-TOP: 0px">
  <DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>So in 
  essence, there's no way to use a function to insert a string literal into a 
  rule from a template?</FONT></SPAN></DIV><BR>
  <DIV lang=en-us dir=ltr align=left>
  <HR>
  <FONT face=Tahoma size=2><B>From:</B> FrankVhh [via Drools] [mailto:<A 
  href="http://user/SendEmail.jtp?type=node&amp;node=3009838&amp;i=0" 
  target=_blank rel="nofollow" link="external">[hidden email]</A>] 
  <BR><B>Sent:</B> 31 May 2011 17:20<BR><B>To:</B> Mullard, 
  Christopher<BR><B>Subject:</B> RE: Smart Templates<BR></FONT><BR></DIV>
  <DIV></DIV>But then that would call the service.getType() method when the rule 
  is <BR>run wouldn't it? <BR>-&gt; Yes <BR>Â&nbsp; <BR>I'm trying create 
  explicit, simple rules to avoid doing extra work when <BR>running data through 
  them. <BR>-&gt; OK, in essence, I like that :-) <BR>Â&nbsp; <BR>How would you 
  use a rule to set the value within another rule? <BR>-&gt; I am not sure that 
  I follow you here... <BR>If you want to avoid to execute the getType()-service 
  at rule execution, then you would need to add an attribute name to your 
  object, and call getType() before creating the rules. <BR><BR>Alternatively, 
  you can insert an intermediate value whose value will be set by another rule 
  and then use this intermediate value in your DC rules. <BR><BR>When 
  <BR>Service(value = "AAA") <BR>Then <BR>String name = "Type1"; 
  <BR>insert(name); <BR><BR>Something like this... but make sure not to create a 
  loop :-) <BR><BR>Regards, <BR>Frank <BR><BR>
  <BLOCKQUOTE 
  style="PADDING-RIGHT: 1em; PADDING-LEFT: 1em; PADDING-BOTTOM: 0px; BORDER-LEFT: #cccccc 2px solid; PADDING-TOP: 0px">
    <DIV>
    <DIV style="FONT-WEIGHT: bold">ChrisMu wrote:</DIV>
    <DIV>But then that would call the service.getType() method when the rule is 
    <BR>run wouldn't it? <BR>Â&nbsp; <BR>I'm trying create explicit, simple 
    rules to avoid doing extra work when <BR>running data through them. 
    <BR>Â&nbsp; <BR>How would you use a rule to set the value within another 
    rule? <BR>Â&nbsp; <BR>Thanks <BR>Chris 
    <BR><BR>________________________________ <BR><BR>From: FrankVhh [via Drools] 
    <BR>[mailto:<A 
    href="http://user/SendEmail.jtp?type=node&amp;node=3006773&amp;i=0" 
    target=_blank rel="nofollow" link="external">[hidden email]</A>] <BR>Sent: 31 
    May 2011 16:48 <BR>To: Mullard, Christopher <BR>Subject: Re: Smart Templates 
    <BR><BR><BR>Hi, <BR><BR>The way I see it, this is the way your template 
    should look like. I do <BR>not see the need to use eval() at all. 
    <BR><BR>rule "DC_0" <BR>when <BR>Â&nbsp; Â&nbsp; $service: Service(name == 
    "@{service}", value == "@{value}") <BR>Â&nbsp; Â&nbsp; $riskType: RiskType() 
    <BR>then <BR>Â&nbsp; Â&nbsp; 
    $riskType.setName($service.getType("@{value}")); <BR>Â&nbsp; Â&nbsp; 
    $riskType.setAtt(0,"@{value}"); <BR>end <BR><BR>I am assuming that RiskType 
    is already inserted in WM, but you could <BR>just as well create a new 
    object in the then-part of the rule. <BR><BR>In stead of using the 
    java-function to determine the name, you might <BR>actually just as well 
    create an other rule that sets the name according <BR>to the value, thus 
    putting the entire decision logic in rules. <BR><BR>Hope this helps. 
    <BR><BR>Regards, <BR>Frank <BR><BR><BR><BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    ChrisMu wrote: <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Hi, <BR>Â&nbsp; Â&nbsp; 
    Â&nbsp; Â&nbsp; <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp;I'm trying to get 
    a template (.drt) to generate 2 rules (.drl) <BR>from 2 datasets but by 
    doing a little bit more work than direct <BR>substitution. <BR>Â&nbsp; 
    Â&nbsp; Â&nbsp; Â&nbsp; <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Data 
    (service,value): <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; DC, AAA <BR>Â&nbsp; 
    Â&nbsp; Â&nbsp; Â&nbsp; DC, XYZ <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Idea for the template - if value is of 
    type1 then create Type <BR>object with 'Type1' as name. If value is of 
    type2, use 'Type2' as name: <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; <BR>Â&nbsp; 
    Â&nbsp; Â&nbsp; Â&nbsp; rule "DC_@{row.rowNumber}" <BR>Â&nbsp; Â&nbsp; 
    Â&nbsp; Â&nbsp; when <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    Service(name == "DC") Â&nbsp; Â&nbsp; <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    then <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    Type.setName(eval(Service.getType(@{value}))) <BR>Â&nbsp; Â&nbsp; Â&nbsp; 
    Â&nbsp; Â&nbsp; Â&nbsp; Type.setAtt(0,@{value}) <BR>Â&nbsp; Â&nbsp; Â&nbsp; 
    Â&nbsp; end template <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; <BR>Â&nbsp; Â&nbsp; 
    Â&nbsp; Â&nbsp; eval(Service.getType(@{arg0})) should take 'AAA' or 'XYZ' 
    etc as <BR>arg and return a string Type1/Type2 etc. <BR>Â&nbsp; Â&nbsp; 
    Â&nbsp; Â&nbsp; <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; This would then generate 
    2 rules that look like: <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; <BR>Â&nbsp; 
    Â&nbsp; Â&nbsp; Â&nbsp; rule "DC_0" <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; when 
    <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Service(name == "DC", 
    value == "AAA") Â&nbsp; Â&nbsp; <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; then 
    <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    RiskType.setName("Type1") <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    Â&nbsp; RiskType.setAtt(0,"AAA") <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; rule "DC_1" <BR>Â&nbsp; Â&nbsp; Â&nbsp; 
    Â&nbsp; when <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    Service(name == "DC", value == "XYZ") Â&nbsp; Â&nbsp; <BR>Â&nbsp; Â&nbsp; 
    Â&nbsp; Â&nbsp; then <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    RiskType.setName("Type2") <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    Â&nbsp; RiskType.setAtt(0,"XYZ") <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; ...is this possible at all? I'm trying 
    to avoid the eval step <BR>being done in the actual rule (.drl) . 
    <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; 
    Thanks <BR>Â&nbsp; Â&nbsp; Â&nbsp; Â&nbsp; <BR>Â&nbsp; Â&nbsp; Â&nbsp; 
    Â&nbsp; Chris <BR><BR><BR><BR>________________________________ <BR><BR>If 
    you reply to this email, your message will be added to the discussion 
    <BR>below: <BR><A 
    href="http://drools.46999.n3.nabble.com/Smart-Templates-tp3006479p3006589.html" 
    target=_blank rel="nofollow" link="external">http://drools.46999.n3.nabble.com/Smart-Templates-tp3006479p3006589.html</A><BR><BR>To 
    unsubscribe from Smart Templates, click here <BR>&lt;<A 
    href="http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubs" 
    target=_blank rel="nofollow" link="external">http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubs</A><BR>cribe_by_code&amp;node=3006479&amp;code=Y2hyaXN0b3BoZXIubXVsbGFyZEBjcmVkaXQtc3Vp 
    <BR>c3NlLmNvbXwzMDA2NDc5fDE5NzczMDY1MzE=&gt; . 
    <BR><BR>=============================================================================== 
    <BR>Please access the attached hyperlink for an important electronic 
    communications disclaimer: <BR><A 
    href="http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html" 
    target=_blank rel="nofollow" link="external">http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html</A>Â&nbsp; 
    <BR>=============================================================================== 
    </DIV></DIV></BLOCKQUOTE><BR><BR>
  <HR color=#cccccc noShade SIZE=1>

  <DIV 
  style="FONT: 12px tahoma,geneva,helvetica,arial,sans-serif; COLOR: rgb(68,68,68); font-size-adjust: none; font-stretch: normal">
  <DIV style="FONT-WEIGHT: bold">If you reply to this email, your message will 
  be added to the discussion below:</DIV><A 
  href="http://drools.46999.n3.nabble.com/Smart-Templates-tp3006479p3006773.html" 
  target=_blank rel="nofollow" link="external">http://drools.46999.n3.nabble.com/Smart-Templates-tp3006479p3006773.html</A> 
  </DIV>
  <DIV 
  style="MARGIN-TOP: 0.4em; FONT: 11px tahoma,geneva,helvetica,arial,sans-serif; COLOR: rgb(102,102,102); font-size-adjust: none; font-stretch: normal">To 
  unsubscribe from Smart Templates, <A target=_top rel="nofollow" link="external">click here</A>. </DIV><BR>
  <P class=MsoNormal><SPAN lang=EN-US 
  style="FONT-SIZE: 8pt; FONT-FAMILY: Courier">==============================================================================<BR>Please 
  access the attached hyperlink for an important electronic communications 
  disclaimer:<BR><A 
  href="http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html" 
  target=_blank rel="nofollow" link="external">http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html</A><BR>==============================================================================</SPAN></P><BR><BR>
  <HR align=left width=300>
  View this message in context: <A 
  href="http://drools.46999.n3.nabble.com/Smart-Templates-tp3006479p3009838.html" 
  target=_blank rel="nofollow" link="external">RE: Smart Templates</A><BR>Sent 
  from the <A 
  href="http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html" 
  target=_blank rel="nofollow" link="external">Drools: User forum mailing list 
  archive</A> at 
  Nabble.com.<BR><BR>_______________________________________________<BR>rules-users 
  mailing list<BR><A 
  href="/user/SendEmail.jtp?type=node&amp;node=3009984&amp;i=1" target=_top rel="nofollow" link="external">[hidden email]</A><BR><A 
  href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank rel="nofollow" link="external">https://lists.jboss.org/mailman/listinfo/rules-users</A><BR><BR></BLOCKQUOTE></DIV><BR><BR>_______________________________________________ 
<BR>rules-users mailing list <BR><A 
href="/user/SendEmail.jtp?type=node&amp;node=3009984&amp;i=2" target=_top rel="nofollow" link="external">[hidden email]</A> <BR><A 
href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_top rel="nofollow" link="external">https://lists.jboss.org/mailman/listinfo/rules-users</A><BR><BR><BR>
<HR color=#cccccc noShade SIZE=1>

<DIV style="FONT: 12px tahoma,geneva,helvetica,arial,sans-serif; COLOR: #444">
<DIV style="FONT-WEIGHT: bold">If you reply to this email, your message will be 
added to the discussion below:</DIV><A 
href="http://drools.46999.n3.nabble.com/Smart-Templates-tp3006479p3009984.html" target="_top" rel="nofollow" link="external">http://drools.46999.n3.nabble.com/Smart-Templates-tp3006479p3009984.html</A> 
</DIV>
<DIV 
style="MARGIN-TOP: 0.4em; FONT: 11px tahoma,geneva,helvetica,arial,sans-serif; COLOR: #666">To 
unsubscribe from Smart Templates, <A 
href="" target="_top" rel="nofollow" link="external">click 
here</A>. </DIV> <BR/><p class=MsoNormal><span lang=EN-US style='font-size:8.0pt;font-family:Courier'>==============================================================================<br>Please access the attached hyperlink for an important electronic communications disclaimer:<br><a href="http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html" target="_top" rel="nofollow" link="external">http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html</a><br>==============================================================================<o:p></o:p></span></p> <br>


        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://drools.46999.n3.nabble.com/Smart-Templates-tp3006479p3010031.html">RE: [rules-users] Smart Templates</a><br/>
Sent from the <a href="http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html">Drools: User forum mailing list archive</a> at Nabble.com.<br/>