<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=265533408-01062011><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 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=3009838&i=0" target="_top" 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 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">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="/user/SendEmail.jtp?type=node&amp;node=3006773&amp;i=0" 
  target=_top 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=_top 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=_top 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=_top 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: #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-tp3006479p3006773.html" target="_top" 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: #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-tp3006479p3009838.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/>