<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.6082" name=GENERATOR>
<DIV dir=ltr align=left><SPAN class=563584915-31052011><FONT face=Arial
color=#0000ff size=2>But then that would call the service.getType() method when
the rule is run wouldn't it?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=563584915-31052011><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=563584915-31052011><FONT face=Arial
color=#0000ff size=2>I'm trying create explicit, simple rules to avoid doing
extra work when running data through them.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=563584915-31052011><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=563584915-31052011><FONT face=Arial
color=#0000ff size=2>How would you use a rule to set the value within another
rule?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=563584915-31052011><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=563584915-31052011><FONT face=Arial
color=#0000ff size=2>Thanks</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=563584915-31052011><FONT face=Arial
color=#0000ff size=2>Chris</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> FrankVhh [via Drools]
[mailto:<a href="/user/SendEmail.jtp?type=node&node=3006618&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>] <BR><B>Sent:</B> 31 May
2011 16:48<BR><B>To:</B> Mullard, Christopher<BR><B>Subject:</B> Re: Smart
Templates<BR></FONT><BR></DIV>
<DIV></DIV>Hi, <BR><BR>The way I see it, this is the way your template should
look like. I do 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 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 actually just as well create an other rule that sets the
name according to the value, thus putting the entire decision logic in rules.
<BR><BR>Hope this helps. <BR><BR>Regards, <BR>Frank <BR><BR>
<BLOCKQUOTE class="quote light-black dark-border-color"
style="PADDING-RIGHT: 1em; PADDING-LEFT: 1em; PADDING-BOTTOM: 0px; BORDER-LEFT: #cccccc 2px solid; PADDING-TOP: 0px">
<DIV class="quote light-border-color">
<DIV class=quote-author style="FONT-WEIGHT: bold">ChrisMu wrote:</DIV>
<DIV class="quote-message shrinkable-quote">Hi, <BR><BR> I'm trying to
get a template (.drt) to generate 2 rules (.drl) from 2 datasets but by doing
a little bit more work than direct 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 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 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 being done in the actual rule (.drl) .
<BR><BR>Thanks <BR><BR>Chris </DIV></DIV></BLOCKQUOTE><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-tp3006479p3006589.html" target="_top" rel="nofollow" link="external">http://drools.46999.n3.nabble.com/Smart-Templates-tp3006479p3006589.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-tp3006479p3006618.html">RE: 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/>