[rules-users] Problem with passing a variable to a function

larryc larry.chambers at sentry.com
Fri Mar 30 13:14:31 EDT 2012


Hi, one of our developers is having a problem with a specific rule.  Within
the condition he needs to call a function passing a value from a variable
reference defined earlier in the condition.  If he hard codes the value (for
example passing a 1 instead of the variable) the rule works fine.  If we use
$driverSequence (which should be some integer) the rule will not fire.

This is the rule that is giving us problems.  At the end of the "when" if we
replace $driverSequence with a 1 then it works.  Any ideas???

rule "DriverChangeAutoLoss"
dialect "mvel"
when
               policy : Policy()
               $Driver : Driver( $driverSequence : driverSequence,
(eval(driverSequence == findPrimaryDriverSequence(policy))) )
               (UWRDelta (driversAdded != null, driversAdded contains
$driverSequence ) or UWRDelta(driverChanges != null,
eval(isDriverChange(this, $driverSequence  ))))
then
              
uwReportCriteria.addUWReport($Driver,"AutoLoss","CACHE_ONLY",null);
end


--
View this message in context: http://drools.46999.n3.nabble.com/Problem-with-passing-a-variable-to-a-function-tp3871474p3871474.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list