There was an almost identical posting not long ago...<br><br>Repeating: As
you present this code, it doesn&#39;t make any sense. The condition is a
join of two objects, and all parameters are literals - very unlikely.<br>
<br>Providing an object to collect results is one reasonable way of doing it.<br><br>But the syntax of modify is incorrect. This would be correct:<br>    modify ($projRes) {  setResult(&quot;Drools project&quot;)  }<br><br>
Most likely, this rule will loop. Either check that field &quot;result&quot; in $projRes is still unset or use rule attribute no-loop true.<br><br>-W<br><br><br><br><div class="gmail_quote">On 11 August 2011 00:15, Dibya <span dir="ltr">&lt;<a href="mailto:dibya.tcs@gmail.com">dibya.tcs@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;">I have the below two requirement for Drools implementation.<br>
<br>
1. To use a java method(with single argument) of my application class in the<br>
&#39;LHS&#39; of the rule .<br>
2. To pass the object set in &#39;RHS&#39; of the rule back to my application.<br>
<br>
Is it possible to implement point 1 and point 2 as below ?<br>
<br>
Example :<br>
<br>
Application class is defined as :<br>
<br>
//Class for getting various types from my application<br>
<br>
package application.custom;<br>
<br>
public class Project<br>
{<br>
    public string getStringValue(String name) {<br>
                &lt;Logic of the application&gt;<br>
                return ;<br>
        }<br>
}<br>
<br>
//Class 2 for setting the rule result<br>
<br>
package application.customresults;<br>
<br>
public class ProjectResults<br>
{<br>
    public void setResult(String name) {<br>
                &lt;Logic of the application&gt;<br>
<br>
        }}<br>
<br>
===========================================================================<br>
Drl file like :<br>
<br>
package application.rules<br>
<br>
#I shall set the object &#39;projRes&#39;  in my appl using setGlobal<br>
global application.customresults.ProjectResults  projRes ;<br>
<br>
import application.custom.Project;<br>
<br>
rule &quot;project-1.option1&quot;<br>
<br>
when<br>
<br>
$proj : application.custom.Project();<br>
<br>
eval ($proj.getStringValue(&quot;Drools&quot;) .equals (&quot;ABC&quot;)) # Logic specific to my<br>
application<br>
<br>
then<br>
#Requirement is to set and make use of the object &#39;projRes&#39; in my<br>
application<br>
<br>
modify (projRes) {projRes.setResult(&quot;Drools project&quot;);  }<br>
end<br>
<br>
rule &quot;project-1.option2&quot;<br>
<br>
when<br>
<br>
$proj : application.custom.Project();<br>
$projRes : application.customresults.ProjectResults();<br>
<br>
eval ($proj.getStringValue(&quot;Java&quot;) .equals (&quot;DEF&quot;)) # Logic specific to my<br>
application<br>
<br>
then<br>
#Requirement is to set and make use of the object &#39;projRes&#39; in my<br>
application<br>
<br>
modify (projRes) {projRes.setResult(&quot;Java project&quot;);<br>
 }<br>
end<br>
<br>
<br>
Please let me know if the above way of writing the drl would suffice both<br>
the requirements (or) is there a better way to implement it.<br>
<br>
Thanks<br>
Dibya<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Drools-Queries-with-relation-to-the-LHS-and-RHS-syntax-of-the-rule-tp3244097p3244097.html" target="_blank">http://drools.46999.n3.nabble.com/Drools-Queries-with-relation-to-the-LHS-and-RHS-syntax-of-the-rule-tp3244097p3244097.html</a><br>

Sent from the Drools: User forum mailing list archive at Nabble.com.<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>
</font></blockquote></div><br>