<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div>4.0.7<br><br>This works if I do $changedEventCodes : List( ) from SubmissionReviewRulesActionHelper.checkIfEventCodesExist(
submission, entityManager );<br><br>However, there might be something added to the function after the call for example in terms of a message passed to the end user. I don't want to have to depend on the<br>Java method to handle the formatting for rule. It should simply be concerned with returning the requested data.<br><br>One more thing I noticed that was odd to. For this particular rule I can't filter it out. <br><br>I have a .drl with 4 rules. If I do something like this:<br><br>this.workingMemory.fireAllRules( new RuleNameStartsWithAgendaFilter( "FIRST" ) );<br><br>This rule which is clearly starting with "SECOND" fires as well.<br><br>The other rules THIRD and FOURTH behave as expected and do not fire but this one still does. Could it be something to do with calling a static method?<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size:
 12pt;">----- Original Message ----<br>From: Mark Proctor &lt;mproctor@codehaus.org&gt;<br>To: Rules Users List &lt;rules-users@lists.jboss.org&gt;<br>Sent: Friday, August 15, 2008 2:48:17 PM<br>Subject: Re: [rules-users] How do I assign a local variable from a function call?<br><br>



  

What version of drools you using? I think I remember some issue with
calling functions directly from a "from" - not sure if it was fixed for
4.0.7 or if is in the upcomfing 4.0.8.<br><br>
Mark<br>
Samuel Doyle wrote:
<blockquote type="cite"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div>Yes here is the full thing.<br><br>
function List doEventCodesExist( Submission submission, EntityManager
entityManager )<br>
{<br>
&nbsp;&nbsp; return SubmissionReviewRulesActionHelper.checkIfEventCodesExist(
submission, entityManager );<br>
}<br><br>
rule "SECOND Event Codes must not exist - EPC"<br>
// 4(2)<br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $event: Event( );<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $submission: Submission( );<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $entityManager : EntityManager( );<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $changedEventCodes : List( ) from doEventCodesExist(
$submission, $entityManager );<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; eval( $changedEventCodes.size() &gt; 0 );<br>
&nbsp;&nbsp;&nbsp; then<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $event.addReviewIssue( new ReviewIssue( $event, $submission,
SubmissionReviewConstants.SUBMISSION,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; ReviewCriticality.CRITICAL, SectionFiltersEnum.SUBMISSION,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; $changedEventCodes + "
submissionReview.submission.eventCodesAlreadyExist" ) );<br>
end<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">-----
Original Message ----<br>
From: Mark Proctor <a rel="nofollow" class="moz-txt-link-rfc2396E" ymailto="mailto:mproctor@codehaus.org" target="_blank" href="mailto:mproctor@codehaus.org">&lt;mproctor@codehaus.org&gt;</a><br>
To: Rules Users List <a rel="nofollow" class="moz-txt-link-rfc2396E" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">&lt;rules-users@lists.jboss.org&gt;</a><br>
Sent: Friday, August 15, 2008 1:29:16 PM<br>
Subject: Re: [rules-users] How do I assign a local variable from a
function call?<br><br>
Did you try adding types to your functions like the documentation says?<br><br>
samd wrote:
  <blockquote type="cite"><pre>Nobody knows?<br><br><br>samd wrote:<br></pre><blockquote type="cite"><pre>All I want to do is something simple like the following:<br><br>$changedList: java.util.List( ) from getChangedList( $x, $y );<br><br>Then in the same .drl file a function something like:<br><br>function List getChangedList( $x, $y )<br>{<br>    return JavaClass.staticDoSomethingToGetListMethod( $x, $y);<br>}<br><br>I have tried doing this and I get:<br><br>Unable to build expression for 'from' node 'getChangedList( $x, $y)'<br><br>It looks like there is supposed to be something in between the from and<br>the function? I have been looking for examples for something like this and<br>have not found any.<br><br>Thanks<br><br></pre></blockquote><pre></pre></blockquote><br></div></div></div><pre><hr size="4" width="90%"><br>_______________________________________________<br>rules-users mailing list<br><a rel="nofollow" class="moz-txt-link-abbreviated"
 ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a rel="nofollow" class="moz-txt-link-freetext" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></pre></blockquote><br></div></div></div></body></html>