rule "SupplierView: Headquarter Supplier Code should end on 25 or 30."
when
$cs : SupplierView(corporate ==
true, eval(
suppCode.substring(4, 6).equals( "25" )
|| suppCode.substring(4, 6).equals( "30" ) ) )
then
ValidationErrorFacade.getInstance().registerError($cs, new ValidationError("Headquarter Supplier Code should end on 25 or 30."));
end
rule "SupplierView: Headquarter Supplier Code should end on 25 or 30."
when
$cs : SupplierView(corporate ==
true,
suppCode matches ".*25"
|| matches ".*30" )
then
ValidationErrorFacade.getInstance().registerError($cs, new ValidationError("Headquarter Supplier Code should end on 25 or 30."));
end
Folks,
I have a rule where I am repeating part of it twice : ($cs.getSuppCode().substring(4, 6)), and I would like to replace it with variable… how can I do that? The solution with "in" doesn't worl because it is a java code needed to perform calculations for variable…..
Please see the rule below:
rule "SupplierView: Headquarter Supplier Code should end on 25 or 30."
when
$cs : SupplierView(corporate == true)
eval($cs.getSuppCode().substring(4, 6) == "25" || $cs.getSuppCode().substring(4, 6) == "30")
then
ValidationErrorFacade.getInstance().registerError($cs, new ValidationError("Headquarter Supplier Code should end on 25 or 30."));
end
Thanks,
-Sergey
**********************
** LEGAL DISCLAIMER **
**********************
This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users