<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:m="http://schemas.microsoft.com/office/2004/12/omml" 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;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        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
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I think what you are looking for is the following.&nbsp; Someone
please correct me if I am incorrect.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>when<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>Order($discount : discount
&gt; 10, $items: items)<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>Item(grade &gt; 3) from
$items<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>then<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:.5in'><span style='font-size:10.0pt;
font-family:"Verdana","sans-serif"'>System.err.print(&#8220;Discount is not
allowed with items having grade 3 or higher&#8221;);</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>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>This would fire when an Order has a discount greater than 10 and
an&nbsp; item with a grade greater than 3.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Not sure why you even need the $discount variable.&nbsp; You
could just do Order(discount &gt; 10, $items : items) for the first line of the
when clause.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
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>Shabbir Dhari<br>
<b>Sent:</b> Tuesday, February 23, 2010 5:27 PM<br>
<b>To:</b> rules-users@lists.jboss.org<br>
<b>Subject:</b> Re: [rules-users] Using Collections in LHS<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Hi W<br>
<br>
I know about case sensitivity issue. How can I combine both Order and Item in
one condition. I tried all possibilities but getting syntax error.<br>
<br>
For example: <o:p></o:p></p>

<p class=MsoNormal>Order ($items : items, $discount : discount &gt; 10,
Item(grade &gt; 3) from $items) // gives error<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Can please code this condition correctly for me?<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Dhari<o:p></o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;
font-family:"Verdana","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<div class=MsoNormal align=center style='text-align:center'><span
style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>

<hr size=2 width="100%" align=center id=stopSpelling>

</span></div>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;
font-family:"Verdana","sans-serif"'>Date: Tue, 23 Feb 2010 13:43:01 +0100<br>
From: wolfgang.laun@gmail.com<br>
To: rules-users@lists.jboss.org<br>
Subject: Re: [rules-users] Using Collections in LHS<br>
<br>
Discount is a field of Order and must not appear in an Item(...).<br>
Probably you want:<br>
&nbsp;&nbsp; Order &nbsp;( $discount : Discount &gt; 10,...<br>
<br>
Also, most likely, all your fields need to be written with a lower case initial
letter,<br>
&nbsp;&nbsp; Order &nbsp;( $discount : discount &gt; 10, $items : items)<br>
<br>
-W<o:p></o:p></span></p>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>On
Tue, Feb 23, 2010 at 1:11 PM, dhari &lt;<a href="mailto:sdhari@hotmail.com">sdhari@hotmail.com</a>&gt;
wrote:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><br>
In this scenario I do have typical Order and Items data structure. I want to<br>
implement various business rules where I want to check both Order attributes<br>
and Item attributes together.<br>
<br>
Order [ Date, Discount, Amount, Customer, Type, Items]<br>
Item [ Quantity, Rate, ExpiresDate, Grade ]<br>
<br>
I am trying to implements following rules but all gives me syntax error. I<br>
wondering if someone can help me in.<br>
<br>
<br>
rule one<br>
&nbsp; &nbsp;when<br>
&nbsp; &nbsp; &nbsp; &nbsp;Order &nbsp;( $discount : Discount, $items : Items)<br>
&nbsp; &nbsp; &nbsp; &nbsp;Item ($discount &gt; 10 &amp;&amp; Grade &gt; 3)
from $items<br>
&nbsp; &nbsp;then<br>
&nbsp; &nbsp; &nbsp; &nbsp;System.err.print(Discount is not allowed with items
having grade 3 or<br>
higher)<br>
end<br>
<br>
rule two<br>
&nbsp; &nbsp;when<br>
&nbsp; &nbsp; &nbsp; &nbsp;Order &nbsp;( $discount : Discount, $items : Items)<br>
&nbsp; &nbsp; &nbsp; &nbsp;Item ($discount &nbsp;&gt; 20 || Quantity &lt; 5 )
from $items<br>
&nbsp; &nbsp;then<br>
&nbsp; &nbsp; &nbsp; &nbsp;//do some thinge<br>
end<br>
<span style='color:#888888'>--<br>
View this message in context: <a
href="http://n3.nabble.com/Using-Collections-in-LHS-tp386923p386923.html">http://n3.nabble.com/Using-Collections-in-LHS-tp386923p386923.html</a><br>
Sent from the Drools - User mailing list archive at Nabble.com.<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">https://lists.jboss.org/mailman/listinfo/rules-users</a></span><o:p></o:p></span></p>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;
font-family:"Verdana","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<div class=MsoNormal align=center style='text-align:center'><span
style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>

<hr size=2 width="100%" align=center>

</span></div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>Find
out now <a
href="http://windowslive.ninemsn.com.au/oneinbox?ocid=T162MSN05A0710G"
target="_new">Link all your email accounts and social updates with Hotmail.</a><o:p></o:p></span></p>

</div>

</body>

</html>