<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Why no braces after SomeBusinessLogic?<br>
<br>
Also your logic is wrong there. Item is not a collection so your for
loop is repeating the same action over and over again for the same
data.<br>
<br>
Mark<br>
<br>
On 11/01/2012 09:27, Martin A wrote:
<blockquote
cite="mid:CAB27Hf1EjcMBYfPAgk1U7H_Q3RDX9=OX+nzSeVTP7Af24nGAjw@mail.gmail.com"
type="cite">
<meta http-equiv="Context-Type" content="text/html;
charset=ISO-8859-1">
Hi, Davide,
<div><br>
</div>
<div>Here is how my rule looks like :</div>
<div><br>
</div>
<div>when</div>
<div> $item : Item(param1 != 0, param2 == 0, !(this instanceof
SpecialItem))</div>
<div> $gsc : SomeBusinessLogic</div>
<div>then </div>
<div><span> $gsc.doSomething($</span><a moz-do-not-send="true"
href="http://item.id/">item.id</a><span>);</span><br>
<div> for (int i = 0; i < $item.quantity; i++) {<br>
$gsc.doSomethingElse($<a moz-do-not-send="true"
href="http://item.id/">item.id</a>);<br>
}<br>
update($gsc);</div>
<div>end</div>
<div><br>
</div>
<div>
The above snippet throws an error @ i < $item.quantity, and
says 'no such identifier $item'...</div>
<div>I can't figure out what might be causing this.</div>
<div><br>
</div>
<div>Thanks</div>
<br>
<div>On Tue, Jan 10, 2012 at 10:08 PM, Davide Sottara <span><<a
moz-do-not-send="true" href="mailto:dsotty@gmail.com">dsotty@gmail.com</a>></span>
wrote:<br>
<blockquote>
Did you remember to bind $item to some expression in the LHS
? Maybe you just<br>
called that "item" without the $ :)<br>
Davide<br>
<br>
(the original "modify" syntax is still wrong anyway)<br>
<span> <br>
--<br>
View this message in context: <a moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/rules-users-For-loop-inside-a-modify-block-problem-tp3648460p3648718.html">http://drools.46999.n3.nabble.com/rules-users-For-loop-inside-a-modify-block-problem-tp3648460p3648718.html</a><br>
Sent from the Drools: User forum mailing list archive at
Nabble.com.<br>
</span>
<div>
<div>_______________________________________________<br>
rules-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</body>
</html>