<br><br><div>Is B name of the class? If so it should be name of the variable not the class name.<div>As you are using 4.0.7 the above rule can be written as:</div><div><br></div><div><span class="Apple-style-span" style="border-collapse: collapse; ">rule &quot;test&quot;<br>
&nbsp; &nbsp; &nbsp; &nbsp;salience 20<br>&nbsp; &nbsp; &nbsp; &nbsp;no-loop true<br>&nbsp; &nbsp; &nbsp; &nbsp;when<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$a:A( $b : b);</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; B(X==&quot;testValue&quot;) from $b</span></div>
<div><span class="Apple-style-span" style="border-collapse: collapse; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// eval (b.X == &quot;testValue&quot;); using eval is not a good idea. There might be a performance hit.<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br><div class="Ih2E3d" style="color: rgb(80, 0, 80); ">
&nbsp; &nbsp; &nbsp; &nbsp;then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$a.setSomething();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;update($a);<br>&nbsp; &nbsp; &nbsp; &nbsp;end<br></div></span></div><div><br></div><div>Regards,</div><div>sudhir</div><div><br><div class="gmail_quote">On Mon, Feb 23, 2009 at 5:59 PM, D1vy@@Ind1@ <span dir="ltr">&lt;<a href="mailto:divya.rajendranath@gmail.com">divya.rajendranath@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;"><br>
Sudhir,<br>
Thanks for the information ...<br>
<br>
To give more data..<br>
I am using drools 4.0.7 version.<br>
<br>
I have appropriate setters and getters in all my classes A, B, Z.<br>
<br>
My drools file look like this:<br>
<br>
rule &quot;test&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;salience 20<br>
 &nbsp; &nbsp; &nbsp; &nbsp;no-loop true<br>
 &nbsp; &nbsp; &nbsp; &nbsp;when<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$a:A( b : B);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;eval (b.X == &quot;testValue&quot;);<br>
<div class="Ih2E3d"> &nbsp; &nbsp; &nbsp; &nbsp;then<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$a.setSomething();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;update($a);<br>
 &nbsp; &nbsp; &nbsp; &nbsp;end<br>
<br>
</div>When I run this rule, it says<br>
<br>
Unable to create Field Extractor for &#39;B&#39; : [Rule name=test,<br>
agendaGroup=MAIN, salience=20, no-loop=true]<br>
org.drools.RuntimeDroolsException: org.drools.RuntimeDroolsException:<br>
Field/method &#39;B&#39; not found for class &#39;com.test.java.A&#39;<br>
Rule Compilation error : [Rule name=test, agendaGroup=MAIN, salience=20,<br>
no-loop=true]<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Rule_test_0.java (8:323) : b.X cannot be resolved to a type<br>
E<br>
<br>
I have double checked if there was any typos in defining my fields, and<br>
there exists no problem due to typos.<br>
<br>
Could you please throw light on this exception ?<br>
<br>
<br>
Thanks<br>
-D<br>
<div><div></div><div class="Wj3C7c"><br>
<br>
<br>
<br>
D1vy@@Ind1@ wrote:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; I am planning to use Drools - JBoss Rules Engine. My requirement is to<br>
&gt; disburse mails from my application to different groups based on various<br>
&gt; criteria. I want to use Drools here.<br>
&gt;<br>
&gt; My object structure is as follows:<br>
&gt;<br>
&gt; class A{<br>
&gt;<br>
&gt; String B = &quot;&quot;;<br>
&gt;<br>
&gt; B b;<br>
&gt;<br>
&gt; C c;<br>
&gt; }<br>
&gt;<br>
&gt; Hence Obj A has embedded objects within it, and obj B and C further has<br>
&gt; embedded objects.<br>
&gt;<br>
&gt; class B {<br>
&gt;<br>
&gt; String X;<br>
&gt;<br>
&gt; Z z;<br>
&gt;<br>
&gt; }<br>
&gt;<br>
&gt; class Z{<br>
&gt;<br>
&gt; String t;<br>
&gt;<br>
&gt; String s;<br>
&gt;<br>
&gt; }<br>
&gt;<br>
&gt; The decision on sending the mails based on the fields in embedded objects<br>
&gt; of<br>
&gt; A. I pass instance of A to Drools<br>
&gt;<br>
&gt; Format of drl file:<br>
&gt;<br>
&gt; package...;<br>
&gt;<br>
&gt; import ..;<br>
&gt;<br>
&gt; rule &quot;Test&quot;<br>
&gt;<br>
&gt; when $a:A(B(Z(s == &quot;testvalue&quot;)))<br>
&gt;<br>
&gt; then<br>
&gt;<br>
&gt; $a.setSomething();<br>
&gt;<br>
&gt; update($a);<br>
&gt;<br>
&gt; end<br>
&gt;<br>
&gt; I wanted to know if this (accessing fields in embedded/child object) is<br>
&gt; feasible with Drools.<br>
&gt;<br>
&gt; I get an error saying &quot;UNable to compile myfile.drl when i try to fo this.<br>
&gt;<br>
&gt; Could some one look into this issue and let me know the reason for this ?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Thanks<br>
&gt;<br>
&gt; -D<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
<div class="Ih2E3d">&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
</div><div class="Ih2E3d">&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
&gt;<br>
<br>
</div><font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/Help-on-using-Drools-with-embedded-objects-tp22158087p22160635.html" target="_blank">http://www.nabble.com/Help-on-using-Drools-with-embedded-objects-tp22158087p22160635.html</a><br>

Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
</font><div class="Ih2E3d"><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
</div><div><div></div><div class="Wj3C7c"><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>