I cannot reproduce this error.<br><br>Do NOT rely on the automatic substitution of getters for simple field accesses on a rule&#39;s right hand side, at least not for 5.2.0 CR.<br><br>Moreover, I cannot compile the constraint<br>
   &quot;jones&quot; memberOf authors<br>This should be written as<br>   authors contains &quot;jones&quot;.<br><br>For further analysis full workable code reproducing the issue would be required.<br><br>-W<br><br><br><div class="gmail_quote">
On 3 June 2011 22:47, Simon Chen <span dir="ltr">&lt;<a href="mailto:simonchennj@gmail.com">simonchennj@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Can I maybe do a for loop in the &quot;then&quot; part? Is there a documentation<br>
regarding what is possible/impossible in the &quot;then&quot; part?<br>
<br>
Thanks.<br>
<font color="#888888">-Simon<br>
</font><div><div></div><div class="h5"><br>
On Fri, Jun 3, 2011 at 3:23 PM, Simon Chen &lt;<a href="mailto:simonchennj@gmail.com">simonchennj@gmail.com</a>&gt; wrote:<br>
&gt; No, this doesn&#39;t work...<br>
&gt;<br>
&gt; Drools-5.2 doesn&#39;t help either :-(<br>
&gt;<br>
&gt; 2011/6/2 Joe White &lt;<a href="mailto:Joe.White@recondotech.com">Joe.White@recondotech.com</a>&gt;:<br>
&gt;&gt; If you cast $b on the RHS it will probably work. We’ve had to do this in the<br>
&gt;&gt; past for rules like this.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ….<br>
&gt;&gt;<br>
&gt;&gt; then:<br>
&gt;&gt;  Test fact = new Test();<br>
&gt;&gt;<br>
&gt;&gt; Book rhsBook = (Book)$b;<br>
&gt;&gt;  fact.getList().addAll( rhsBook.authors );<br>
&gt;&gt;  insert(fact);<br>
&gt;&gt; end<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a><br>
&gt;&gt; [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>] On Behalf Of Mark Proctor<br>
&gt;&gt; Sent: Thursday, June 02, 2011 8:52 AM<br>
&gt;&gt; To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; Subject: Re: [rules-users] list operations in &quot;then&quot; part<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On 02/06/2011 08:14, Wolfgang Laun wrote:<br>
&gt;&gt;<br>
&gt;&gt; On 1 June 2011 21:43, Simon Chen &lt;<a href="mailto:simonchennj@gmail.com">simonchennj@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi all,<br>
&gt;&gt;<br>
&gt;&gt; I am always confused about what we can do in the &quot;then&quot; part of the rule.<br>
&gt;&gt;<br>
&gt;&gt; In particular, I have problem duplicate a list. For example:<br>
&gt;&gt;<br>
&gt;&gt; when:<br>
&gt;&gt;  $b: Book( &quot;james&quot; memberOf authors )<br>
&gt;&gt; then:<br>
&gt;&gt;  Test fact = new Test();<br>
&gt;&gt;  fact.getList().addAll( $b.authors );<br>
&gt;&gt;  insert(fact);<br>
&gt;&gt; end<br>
&gt;&gt;<br>
&gt;&gt; The error message reads like this:<br>
&gt;&gt;<br>
&gt;&gt; BuildError: Unable to build expression for &#39;consequence&#39;: [Error:<br>
&gt;&gt; Failed to compile: 2 compilation error(s):<br>
&gt;&gt;  - (1,7) unqualified type in strict mode for: $b<br>
&gt;&gt;  - (1,12) unqualified type in strict mode for: authors]<br>
&gt;&gt;<br>
&gt;&gt; What is the right way to do this?<br>
&gt;&gt;<br>
&gt;&gt; Granted - the error message is a puzzle in itself, but basically, the RHS<br>
&gt;&gt; must be written according to Java rules. Hence, if $b is an object of type<br>
&gt;&gt; Book, $b.authors depends on the (Java!) visibility of member authors. If it<br>
&gt;&gt; isn&#39;t public, you must use the getter.<br>
&gt;&gt;<br>
&gt;&gt; I believe he&#39;s using &quot;mvel&quot; judging by the error.<br>
&gt;&gt;<br>
&gt;&gt; mark<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; -W<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Thanks.<br>
&gt;&gt; -Simon<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt;<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt;<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt;<br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<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><br>
</div></div></blockquote></div><br>