[rules-users] LHS function call

Mark Proctor mproctor at codehaus.org
Tue Oct 16 20:20:16 EDT 2007


earlier releases of MVEL could not call functions or static methods, I 
believe this has now been fixed in 4.0.2 ?

Mark
mark.mcnally at comcast.net wrote:
> Hello,
>
> I get the following error message when attempting to use a function call on the LHS a rule:
>
>     "unable to resolve method using strict-mode: java.lang.Object.normalizedLoad2(...)"
>
>
> My rule and function:
>
> <code>
> rule NarrowByParticipantLoad 
>     dialect "mvel"
> 	salience -75
> 	when
> 	$nd1 : NurseDetails()	
> 	$nd2 : NurseDetails()	
> 	eval(normalizedLoad2( $nd2.hoursPerWeek, $nd2.assignmentCount ) >  
>                 normalizedLoad2($nd1.hoursPerWeek, $nd1.assignmentCount )) 
> 	then 	
> 		retract( $nd2 );
> end
>
> function double normalizedLoad2( int hoursPerWeek, int assignmentCnt ) {
> 	if (hoursPerWeek == 0) {
> 		return 0.0;
> 	}
> 	return  (double)assignmentCnt / (double)hoursPerWeek;				
> }
>
> </code>
>
> I am using v 4.0.1.   It was my understanding that this should be legal.  Is it obvious what I might be ding wrong here?
>
> Thank you, 
> Mark
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>   




More information about the rules-users mailing list