Sorry, the fields are not public, but their getters are. But still not working when I use the getters.<div><br></div><div>Thanks<br><br><div class="gmail_quote">On Wed, Jan 11, 2012 at 12:01 PM, Martin A <span dir="ltr">&lt;<a href="mailto:wmlsub@gmail.com">wmlsub@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hi Michael,<div><br></div><div>All of the fields are public, however they are properties of a super class of Item. I tried with getters, doesn&#39;t work either way. </div>
<div>Still getting: &#39;no such identifier : $item&#39;. When I remove the for loop, it goes ok, so I think it messes up things.</div>
<div><br></div><div>Best regards,</div><div>Martin<div><div class="h5"><br><br><div class="gmail_quote">2012/1/11 Michael Anstis <span dir="ltr">&lt;<a href="mailto:michael.anstis@gmail.com" target="_blank">michael.anstis@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
RHS is not DRL syntax but Java or MVEL depending on your dialect.<br><br>If &quot;id&quot; is not public you should use it&#39;s getter. The same goes for &quot;quantity&quot;.<div><br><br><span style="font-family:courier new,monospace">when</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">    $item : Item(param1 != 0, param2 == 0, !(this instanceof SpecialItem))</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    $gsc : SomeBusinessLogic</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">then </span><br style="font-family:courier new,monospace"></div><span style="font-family:courier new,monospace">    $gsc.doSomething($item.getId() );</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">    for (int i = 0; i &lt; $item.getQuantity(); i++) {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        $gsc.doSomethingElse($item.getId() );</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    update($gsc);</span><br style="font-family:courier new,monospace">


<span style="font-family:courier new,monospace">end</span><div><div><br style="font-family:courier new,monospace"><br><br><div class="gmail_quote">2012/1/11 Martin A <span dir="ltr">&lt;<a href="mailto:wmlsub@gmail.com" target="_blank">wmlsub@gmail.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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 href="http://item.id/" target="_blank">item.id</a><span>);</span><br><div><div>    for (int i = 0; i &lt; $item.quantity; i++) {<br></div>
        $gsc.doSomethingElse($<a href="http://item.id/" style="color:rgb(17,85,204)" target="_blank">item.id</a>);<br>    }<br>    update($gsc);</div><div>end</div><div><br></div><div>
The above snippet throws an error @ i &lt; $item.quantity, and says &#39;no such identifier $item&#39;...</div><div>I can&#39;t figure out what might be causing this.</div><div><br></div>
<div>Thanks</div><div><div><br><div class="gmail_quote">On Tue, Jan 10, 2012 at 10:08 PM, Davide Sottara <span dir="ltr">&lt;<a href="mailto:dsotty@gmail.com" target="_blank">dsotty@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Did you remember to bind $item to some expression in the LHS ? Maybe you just<br>
called that &quot;item&quot; without the $ :)<br>
Davide<br>
<br>
(the original &quot;modify&quot; syntax is still wrong anyway)<br>
<span><font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/rules-users-For-loop-inside-a-modify-block-problem-tp3648460p3648718.html" target="_blank">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>
</font></span><div><div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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><br>
</div></div></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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><br>
<br></blockquote></div><br>
</div></div><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div>