<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)">
<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;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1641113284;
        mso-list-type:hybrid;
        mso-list-template-ids:745550424 134807567 134807577 134807579 134807567 134807577 134807579 134807567 134807577 134807579;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</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="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">There are two other solutions if you do need the p:<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if !supportLists]><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">Change your condition to be “name matches $param”, this will match as a regular expressions. Your general case can then be “.*”.<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if !supportLists]><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D">Merge your p:CProduct across two columns. Have a condition of “this != $param” for the first column and give all the rows in this column the value
of null. Your second column can be name and then be missing in the general clause. For the general clause this will evaluate to:
<o:p></o:p></span></p>
<p class="MsoNormal">rule "Case general"<br>
salience 0<br>
activation-group "g1"<br>
when<br>
p : CProduct( this != null )<br>
then<br>
System.out.println("Normal product: " + p.getName());<br>
end<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">which obviously will always evaluate to true for any CProduct.<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">The other general thing you need to watch out for with a spreadsheet of this form is if you have any rules which update CProduct as these rules would then
be re-evaluated and re-executed again. In particular if you have any rules of a lower salience that update the name then the activation group doesn’t stop a different rule from being fired – activation groups are only mutually exclusive at a given point in
time when the activation occurs, they don’t prevent different later re-activations.<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>
<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>Mauricio Salatino<br>
<b>Sent:</b> 28 July 2010 04:58<br>
<b>To:</b> Rules Users List<br>
<b>Subject:</b> Re: [rules-users] General rules in spreadsheet.<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">you can remove p, because in the spreadsheet you are not using it..
<br>
in the rules you use p to print the type of the product but in the spreadsheet you are hardcoding the value in the "what to print" column<o:p></o:p></p>
<div>
<p class="MsoNormal">2010/7/27 tom ska <<a href="mailto:tiberium.linux@gmail.com">tiberium.linux@gmail.com</a>><o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hello,<br>
I want to use StatelessSession with spreadsheet. I wrote few rules in DRL, but I cant do it in spreadsheet. First I want to present rules and class that is used by rules:<br>
<br>
public class CProduct {<br>
<br>
private String name;<br>
private int value;<br>
<br>
public CProduct ()<br>
{<br>
name = "empty";<br>
value = 0;<br>
}<br>
<br>
public CProduct (String name, int value)<br>
{<br>
<a href="http://this.name" target="_blank">this.name</a> = name;<br>
this.value = value;<br>
}<br>
<br>
public String getName() {<br>
return name;<br>
}<br>
public void setName(String name) {<br>
<a href="http://this.name" target="_blank">this.name</a> = name;<br>
}<br>
public int getValue() {<br>
return value;<br>
}<br>
public void setValue(int value) {<br>
this.value = value;<br>
} <br>
}<br>
<br>
Rules:<br>
<br>
rule "Case A"<br>
salience 1<br>
activation-group "g1"<br>
when<br>
p : CProduct( name == "A" )<br>
then<br>
System.out.println("Special product: " + p.getName());<br>
end<br>
<br>
rule "Case B"<br>
salience 1<br>
activation-group "g1"<br>
when<br>
p : CProduct( name == "B" )<br>
then<br>
System.out.println("Special product: " + p.getName());<br>
end<br>
<br>
rule "Case general"<br>
salience 0<br>
activation-group "g1"<br>
when<br>
p : CProduct( )<br>
then<br>
System.out.println("Normal product: " + p.getName());<br>
end<br>
<br>
Using stateLessSession, salience, and activation-group I can determine, that only one rule is going to be fired for each CProduct. And with salience param, I can determine priority (it is important to get special products first).<br>
Now I am going to write those rules in spreadsheet. But I can't define rule "Case general".<br>
<br>
<o:p></o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="635" style="width:476.0pt;border-collapse:collapse">
<tbody>
<tr style="height:9.0pt;min-height: 9pt">
<td width="167" style="width:125.0pt;padding:0cm 0cm 0cm 0cm;height:9.0pt;
min-height: 9pt">
<p class="MsoNormal" style="mso-line-height-alt:9.0pt"> <o:p></o:p></p>
</td>
<td width="105" style="width:79.0pt;padding:0cm 0cm 0cm 0cm;height:9.0pt">
<p class="MsoNormal" style="mso-line-height-alt:9.0pt">CONDITION<o:p></o:p></p>
</td>
<td width="152" style="width:114.0pt;padding:0cm 0cm 0cm 0cm;height:9.0pt">
<p class="MsoNormal" style="mso-line-height-alt:9.0pt">ACTION<o:p></o:p></p>
</td>
<td width="157" style="width:118.0pt;padding:0cm 0cm 0cm 0cm;height:9.0pt">
<p class="MsoNormal" style="mso-line-height-alt:9.0pt">ACTIVATION-GROUP<o:p></o:p></p>
</td>
<td width="53" style="width:40.0pt;padding:0cm 0cm 0cm 0cm;height:9.0pt">
<p class="MsoNormal" style="mso-line-height-alt:9.0pt">PRIORITY<o:p></o:p></p>
</td>
</tr>
<tr style="height:18.75pt;min-height: 18.75pt">
<td style="padding:0cm 0cm 0cm 0cm;height:18.75pt;min-height: 18.75pt">
<p class="MsoNormal"> <o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:18.75pt">
<p class="MsoNormal">p:CProduct<o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:18.75pt">
<p class="MsoNormal"> <o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:18.75pt">
<p class="MsoNormal"> <o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:18.75pt">
<p class="MsoNormal"> <o:p></o:p></p>
</td>
</tr>
<tr style="height:29.25pt;min-height: 29.25pt">
<td width="167" style="width:125.0pt;padding:0cm 0cm 0cm 0cm;height:29.25pt;
min-height: 29.25pt">
<p class="MsoNormal"> <o:p></o:p></p>
</td>
<td width="105" style="width:79.0pt;padding:0cm 0cm 0cm 0cm;height:29.25pt">
<p class="MsoNormal">name<o:p></o:p></p>
</td>
<td width="152" style="width:114.0pt;padding:0cm 0cm 0cm 0cm;height:29.25pt">
<p class="MsoNormal">System.out.println("$param");<o:p></o:p></p>
</td>
<td width="157" style="width:118.0pt;padding:0cm 0cm 0cm 0cm;height:29.25pt">
<p class="MsoNormal"> <o:p></o:p></p>
</td>
<td width="53" style="width:40.0pt;padding:0cm 0cm 0cm 0cm;height:29.25pt">
<p class="MsoNormal"> <o:p></o:p></p>
</td>
</tr>
<tr style="height:22.5pt;min-height: 22.5pt">
<td width="167" style="width:125.0pt;padding:0cm 0cm 0cm 0cm;height:22.5pt;
min-height: 22.5pt">
<p class="MsoNormal">Rules names<o:p></o:p></p>
</td>
<td width="105" style="width:79.0pt;padding:0cm 0cm 0cm 0cm;height:22.5pt">
<p class="MsoNormal">Product name<o:p></o:p></p>
</td>
<td width="152" style="width:114.0pt;padding:0cm 0cm 0cm 0cm;height:22.5pt">
<p class="MsoNormal">what to print<o:p></o:p></p>
</td>
<td width="157" style="width:118.0pt;padding:0cm 0cm 0cm 0cm;height:22.5pt">
<p class="MsoNormal"> <o:p></o:p></p>
</td>
<td width="53" style="width:40.0pt;padding:0cm 0cm 0cm 0cm;height:22.5pt">
<p class="MsoNormal"> <o:p></o:p></p>
</td>
</tr>
<tr style="height:28.5pt;min-height: 28.5pt">
<td style="padding:0cm 0cm 0cm 0cm;height:28.5pt;min-height: 28.5pt">
<p class="MsoNormal">Case A<o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:28.5pt">
<p class="MsoNormal">A <o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:28.5pt">
<p class="MsoNormal">Special A<o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:28.5pt">
<p class="MsoNormal">G1<o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:28.5pt">
<p class="MsoNormal">1<o:p></o:p></p>
</td>
</tr>
<tr style="height:21.75pt;min-height: 21.75pt">
<td style="padding:0cm 0cm 0cm 0cm;height:21.75pt;min-height: 21.75pt">
<p class="MsoNormal">Case B<o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:21.75pt">
<p class="MsoNormal">B<o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:21.75pt">
<p class="MsoNormal">Special B<o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:21.75pt">
<p class="MsoNormal">G1<o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:21.75pt">
<p class="MsoNormal">1<o:p></o:p></p>
</td>
</tr>
<tr style="height:46.5pt;min-height: 46.5pt">
<td style="padding:0cm 0cm 0cm 0cm;height:46.5pt;min-height: 46.5pt">
<p class="MsoNormal">General case<o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:46.5pt"></td>
<td style="padding:0cm 0cm 0cm 0cm;height:46.5pt">
<p class="MsoNormal">normal<o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:46.5pt">
<p class="MsoNormal">G1<o:p></o:p></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm;height:46.5pt">
<p class="MsoNormal">0<o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
But when I am going to use the spreadsheet, I get this error:<br>
<br>
"p cannot be resolved"<br>
<br>
Problem disappears, when I fill "Product name" in "General case".<br>
<br>
But I want it to be empty, because I want to fire rule "General case" when rules "Case A" & "Case B" won't fire for any object's name.<br>
<br>
Thanks, Tom.<br>
<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <br>
- CTO @ <a href="http://www.plugtree.com">http://www.plugtree.com</a> <br>
- MyJourney @ <a href="http://salaboy.wordpress.com">http://salaboy.wordpress.com</a><br>
- Co-Founder @ <a href="http://www.jbug.com.ar">http://www.jbug.com.ar</a><br>
<br>
- Salatino "Salaboy" Mauricio -<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>
</body>
</html>