<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="Section1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">Hi Gurvinder.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">Not sure where new lines have gone from your email – it makes it very hard to read!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">I’ve also been working on a project which uses decision tables and I couldn’t find any way to use from statements either. I’m hoping to get some time within
the project to work on the drools decision table code to add some improvements, providing support for the from clause is one of these however I’m not sure whether I will get time or not.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">However I think you may be able to restructure your code so that you don’t need the from cause however I’ve not fully tested it. The code relies on their
existing a constructor which takes the promotion code and the equals is defined that P1.equals(P2) when P1.code.equals(P2.code).
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">If you wanted to match that a promotion of a particular name exists then I think you can use the rule<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">Rule “existsPromotion” when<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">Line(promos contains (new Promotion("HOTBUY"))) then ...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">However the expression language doesn’t support “not contains” which means you have to full back to use java:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">rule " contains d"</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:"Courier New""> when<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:"Courier New""> line : Line(eval(!line.getPromos().contains(new Promotion("HOTBUY"))))<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:"Courier New""> then<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:"Courier New""> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">end</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">If you prefer you could also define a method on Line containsPromotionWithCode(code) which would let you choose how to do the match.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">As a spreadsheet the above would then look something like the following:<o:p></o:p></span></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="792" style="width:594.0pt;margin-left:-.9pt;border-collapse:collapse">
<tbody>
<tr style="height:15.75pt">
<td width="203" valign="top" style="width:152.0pt;border:solid windowtext 1.0pt;
border-bottom:none;background:black;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:white">RuleTable Hotbuys<o:p></o:p></span></b></p>
</td>
<td width="291" valign="top" style="width:218.0pt;border-top:solid windowtext 1.0pt;
border-left:none;border-bottom:none;border-right:solid windowtext 1.0pt;
background:black;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black"> <o:p></o:p></span></p>
</td>
<td width="299" valign="top" style="width:224.0pt;border-top:solid windowtext 1.0pt;
border-left:none;border-bottom:none;border-right:solid windowtext 1.0pt;
background:black;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black"> <o:p></o:p></span></p>
</td>
</tr>
<tr style="height:15.75pt">
<td width="203" valign="top" style="width:152.0pt;border:solid windowtext 1.0pt;
border-bottom:none;background:silver;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black">NAME<o:p></o:p></span></b></p>
</td>
<td width="291" valign="top" style="width:218.0pt;border:solid black 1.0pt;
border-left:none;background:#FFCC99;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black">CONDITION<o:p></o:p></span></p>
</td>
<td width="299" valign="top" style="width:224.0pt;border-top:solid windowtext 1.0pt;
border-left:none;border-bottom:none;border-right:solid windowtext 1.0pt;
background:#FFCC99;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black">ACTION<o:p></o:p></span></p>
</td>
</tr>
<tr style="height:15.75pt">
<td width="203" valign="top" style="width:152.0pt;border:solid windowtext 1.0pt;
background:silver;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black"> <o:p></o:p></span></b></p>
</td>
<td width="291" valign="top" style="width:218.0pt;border:none;border-bottom:solid black 1.0pt;
background:#FFCC99;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal" align="center" style="text-align:center"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">l :Line<o:p></o:p></span></p>
</td>
<td width="299" valign="top" style="width:224.0pt;border:solid windowtext 1.0pt;
background:#FFCC99;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black"> <o:p></o:p></span></p>
</td>
</tr>
<tr style="height:30.75pt">
<td width="203" valign="top" style="width:152.0pt;border:solid windowtext 1.0pt;
border-top:none;background:silver;padding:0cm 5.4pt 0cm 5.4pt;height:30.75pt">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black"> <o:p></o:p></span></b></p>
</td>
<td width="291" valign="top" style="width:218.0pt;border:none;border-right:solid black 1.0pt;
background:#FFCC99;padding:0cm 5.4pt 0cm 5.4pt;height:30.75pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black">eval(!l.getPromos().contains(new Promotion("$param")))<o:p></o:p></span></p>
</td>
<td width="299" valign="top" style="width:224.0pt;border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
background:#FFCC99;padding:0cm 5.4pt 0cm 5.4pt;height:30.75pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black">System.out.println("$param");<o:p></o:p></span></p>
</td>
</tr>
<tr style="height:15.75pt">
<td width="203" valign="top" style="width:152.0pt;border:solid windowtext 1.0pt;
border-top:none;background:#CCFFCC;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black">Rule Name<o:p></o:p></span></b></p>
</td>
<td width="291" valign="top" style="width:218.0pt;border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
background:#CCFFFF;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black">Number Directors<o:p></o:p></span></b></p>
</td>
<td width="299" valign="top" style="width:224.0pt;border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
background:#CCFFFF;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black">Warning<o:p></o:p></span></b></p>
</td>
</tr>
<tr style="height:15.75pt">
<td width="203" valign="top" style="width:152.0pt;border:solid windowtext 1.0pt;
border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black">example1<o:p></o:p></span></p>
</td>
<td width="291" valign="top" style="width:218.0pt;border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black">Hotbuys<o:p></o:p></span></p>
</td>
<td width="299" valign="top" style="width:224.0pt;border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
padding:0cm 5.4pt 0cm 5.4pt;height:15.75pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black">Hotbuys missing<o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">Hope that helps,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">Thomas<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:
"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;
font-family:"Tahoma","sans-serif""> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
<b>On Behalf Of </b>groovenarula<br>
<b>Sent:</b> 03 December 2009 06:51<br>
<b>To:</b> rules-users@lists.jboss.org<br>
<b>Subject:</b> [rules-users] Can we use 'from' CE in Decision Tables ?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hello all, Is it possible to define the follow rule in a decision table : rule "Activate Promotion" when l : Line( ) not ( Promotion ( code == "HOTBUY" ) from l.promos ) then #do some action end The rule above works perfectly for what I
need when defined in a rule file. However, when I try to define it in a decision table so that the 'code' can be feed from a spreadsheet, I use the following values in the rules cells : RuleTable HOTBUYS CONDITION ACTION l : Line not ( Promotion ( code ==
"$param" ) from l.promos ) System.out.println("$param added"); PROMOTION PROMOTION HOTBUY BESTBUY I'm getting the following parser errors [10,17]: [ERR 101] Line 10:17 no viable alternative at input 'Promotion' in rule "_11" in pattern Line [10,29]: [ERR 101]
Line 10:29 no viable alternative at input 'code' in rule "_11" [10,63]: [ERR 102] Line 10:63 mismatched input ')' expecting 'then' in rule "_11" java.lang.IllegalArgumentException: Could not parse knowledge. at com.sample.DecisionTableTest.readKnowledgeBase(DecisionTableTest.java:85)
at com.sample.DecisionTableTest.main(DecisionTableTest.java:28) Also in Eclipse IDE, I get the following error : "Unknown error while parsing. This is a bug. Please contact the Development team." NewPromotions.xls Is it possible to use 'from' conditional element
in decision tables ? If so, what am I doing wrong. If not, then what's the best approach to implement the rule above in a decision table. I'm running Drools 5.1.0M1 in Eclipse. Help truly appreciated. Gurvinder
<o:p></o:p></p>
<div class="MsoNormal">
<hr size="2" width="300" style="width:225.0pt" align="left">
</div>
<p class="MsoNormal">View this message in context: <a href="http://n3.nabble.com/Can-we-use-from-CE-in-Decision-Tables-tp67005p67005.html">
Can we use 'from' CE in Decision Tables ?</a><br>
Sent from the <a href="http://n3.nabble.com/Drools-User-f47000.html">Drools - User mailing list archive</a> at Nabble.com.<o:p></o:p></p>
</div>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
**************************************************************************************<br>
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data
may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.<br>
<br>
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00<br>
**************************************************************************************<br>
</font><br>
<hr>
<font face="Arial" color="Gray" size="1">This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The
content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes.<br>
To protect the environment please do not print this e-mail unless necessary.<br>
<br>
An NDS Group Limited company. www.nds.com<br>
</font>
</body>
</html>