<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> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2> at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)<BR> at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:927)<BR> at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)<BR> at
org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)<BR> at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785)<BR> at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751)<BR> at
org.drools.template.parser.TemplateDataListener.finishSheet(TemplateDataListener.java:121)<BR> at
org.drools.template.DataProviderCompiler.finishData(DataProviderCompiler.java:100)<BR> at
org.drools.template.DataProviderCompiler.processData(DataProviderCompiler.java:95)<BR> at
org.drools.template.DataProviderCompiler.compile(DataProviderCompiler.java:73)<BR> at
org.drools.template.ObjectDataCompiler.compile(ObjectDataCompiler.java:44)<BR> at
org.drools.examples.decisiontable.TemplateParser.<init>(TemplateParser.java:33)<BR> 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>
^<BR>[Line: 1, Column: 0]<BR> at
org.drools.template.parser.DefaultGenerator.generate(DefaultGenerator.java:73)<BR> at
org.drools.template.parser.Rule_RFI1_0.defaultConsequence(Rule_RFI1_0.java:7)<BR> at
org.drools.template.parser.Rule_RFI1_0DefaultConsequenceInvoker.evaluate(Rule_RFI1_0DefaultConsequenceInvoker.java:30)<BR> at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)<BR> ...
11 more<BR>Caused by: [Error: unable to resolve method:
java.util.HashMap.value() [arglength=0]]<BR>[Near : {... Unknown
....}]<BR>
^<BR>[Line: 1, Column: 0]<BR> at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:932)<BR> at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:592)<BR> at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:311)<BR> 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> </DIV>
<DIV><SPAN class=048194609-01062011></SPAN><FONT face=Arial color=#0000ff
size=2>My rule template is virtually the 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> $service:ServiceBean(name == "DiscountCurve", value
== "@{value}") <BR> $riskType:RiskType()<BR>then
<BR> $riskType.setName("@{type}");<BR> $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>Â Â if( "AAA".equals( value ) )
return "Type1";<BR>Â Â if( "XYZ".equals( value ) ) return
"Type2";<BR>Â Â ...<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>Â Â $service: Service(name ==
"@{service}", value == "@{value}") <BR>Â Â $riskType: RiskType()
<BR>then <BR>Â Â $riskType.setName("@{type}"); <BR>
<DIV>Â Â $riskType.setAtt(0,"@{value}"); <BR>end
</DIV><BR>-W<BR><BR><BR><BR>
<DIV class=gmail_quote>2011/6/1 ChrisMu <SPAN dir=ltr><<A
href="/user/SendEmail.jtp?type=node&node=3009984&i=0" target=_top rel="nofollow" link="external">[hidden email]</A>></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&node=3009838&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>-> Yes <BR>Â <BR>I'm trying create
explicit, simple rules to avoid doing extra work when <BR>running data through
them. <BR>-> OK, in essence, I like that :-) <BR>Â <BR>How would you
use a rule to set the value within another rule? <BR>-> 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>Â <BR>I'm trying create explicit, simple
rules to avoid doing extra work when <BR>running data through them.
<BR>Â <BR>How would you use a rule to set the value within another
rule? <BR>Â <BR>Thanks <BR>Chris
<BR><BR>________________________________ <BR><BR>From: FrankVhh [via Drools]
<BR>[mailto:<A
href="http://user/SendEmail.jtp?type=node&node=3006773&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>Â Â $service: Service(name ==
"@{service}", value == "@{value}") <BR>Â Â $riskType: RiskType()
<BR>then <BR>Â Â
$riskType.setName($service.getType("@{value}")); <BR>Â Â
$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>Â Â Â Â
ChrisMu wrote: <BR>Â Â Â Â Hi, <BR>Â Â
  <BR>     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>Â
   <BR>    Data
(service,value): <BR>Â Â Â Â DC, AAA <BR>Â
   DC, XYZ <BR>   Â
<BR>Â Â Â Â 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>Â Â Â Â <BR>Â
   rule "DC_@{row.rowNumber}" <BR> Â
  when <BR>     Â
Service(name == "DC") Â Â <BR>Â Â Â Â
then <BR>Â Â Â Â Â Â
Type.setName(eval(Service.getType(@{value}))) <BR>Â Â Â
   Type.setAtt(0,@{value}) <BR>  Â
 end template <BR>    <BR> Â
  eval(Service.getType(@{arg0})) should take 'AAA' or 'XYZ'
etc as <BR>arg and return a string Type1/Type2 etc. <BR>Â Â
  <BR>    This would then generate
2 rules that look like: <BR>Â Â Â Â <BR>Â
   rule "DC_0" <BR>    when
<BR>Â Â Â Â Â Â Service(name == "DC",
value == "AAA") Â Â <BR>Â Â Â Â then
<BR>Â Â Â Â Â Â
RiskType.setName("Type1") <BR>Â Â Â Â Â
 RiskType.setAtt(0,"AAA") <BR>   Â
<BR>Â Â Â Â rule "DC_1" <BR>Â Â Â
 when <BR>     Â
Service(name == "DC", value == "XYZ") Â Â <BR>Â Â
  then <BR>     Â
RiskType.setName("Type2") <BR>Â Â Â Â Â
 RiskType.setAtt(0,"XYZ") <BR>   Â
<BR>Â Â Â Â ...is this possible at all? I'm trying
to avoid the eval step <BR>being done in the actual rule (.drl) .
<BR>Â Â Â Â <BR>Â Â Â Â
Thanks <BR>Â Â Â Â <BR>Â Â Â
 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><<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&node=3006479&code=Y2hyaXN0b3BoZXIubXVsbGFyZEBjcmVkaXQtc3Vp
<BR>c3NlLmNvbXwzMDA2NDc5fDE5NzczMDY1MzE=> .
<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>Â
<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&node=3009984&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&node=3009984&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/>