We had this earlier today ;-)
"Rules are not if statements - salience doesn't change this."
Left hand sides of both rules are fully evaluated for any
XmLifeParticipant. If that value isn't a number, you'll get an error
(unless you write that method very carefully).
-W
On 06/12/2011, ronalbury <ronalbury(a)gmail.com> wrote:
Expert 5.2.Final
My data comes to me as all strings, but I sometimes need to convert some
fields into integers in order to test their value. I wanted to avoid
conversion errors, so I combined rules into an activation-group and used
salience to control the order. However, at runtime I am getting a number
format error in method underWritingClassAsInt. I don't understand why - can
you explain?
rule "XmLifeParticipant underWritingClass Validation"
activation-group "XmLifeParticipant-underWritingClass"
salience 100
when
$lp : XmLifeParticipant(fieldWasModified("underWritingClass")
&& underWritingClass not matches "^\\d$" )
then
$lp.addError(drools.getRule().getName());
end
rule "XmLifeParticipant underWritingClass Value Check"
activation-group "XmLifeParticipant-underWritingClass"
salience 50
when
$lp : XmLifeParticipant(fieldWasModified("underWritingClass")
&& underWritingClassAsInt not in (1, 2, 4, 6))
then
$lp.addError(drools.getRule().getName());
end
--
View this message in context:
http://drools.46999.n3.nabble.com/Salience-activation-group-tp3564649p356...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users