[rules-users] RE: RE: RE: Struggling with Rule syntax - please help...
jdepaul
jjdepaul at us.ibm.com
Wed Mar 28 17:16:16 EDT 2007
Perfect! This is exactly what I needed - for me the key was understanding
that CodesList must extend java.util.ArrayList object... it all fell into
place from there... Thanks very much Michael for all your help - here's my
sample rule definition which I've successfully tested in a test harness:
rule "This rule works!"
no-loop
when
$MILT_CUSTNO : LookupListDOM ( name == "MILT_CUSTNO" ) // extends
ArrayList
$MILT_SHPRNO : LookupListDOM ( name == "MILT_SHPRNO" ) // extends
ArrayList
$gateIN : GATE_IN(
CUSTOMER_REFERENCE_NUMBER matches "^HX.*",
ACTIVITY_LOCATION matches "^US.*",
$sh_code : SH_CODE,
$fo_code : FO_CODE,
( ( $MILT_CUSTNO.contains($sh_code) ) || (
$MILT_SHPRNO.contains($fo_code) ) )
)
then
System.out.println("Matched Customer Rule! About to inovke Service...");
//myService.sendNotification($event, Constants.CUSTOMER_MATCH);
end
Thanks again for helping me resolve this important issue.
Regards,
James
Anstis, Michael (M.) wrote:
>
> Something like this?
> ...
>
> rule "doing something"
> when
> Customer( $custCode : customer_code )
> $codes1 : Codes1List()
> $codes2 : Codes2List()
> $codes3 : Codes3List()
> SHIPMENT_MOVE(
> customer_code == $custCode,
> $sc : ship_code,
> $dc : deliver_code,
> $pc : port_code,
> ( $codes1.containts($sc) || $codes2.containts($dc) ||
> $codes3.containts($pc) )
> )
> then
> // do something
> End
>
>
--
View this message in context: http://www.nabble.com/Struggling-with-Rule-syntax---please-help...-tf3408727.html#a9722263
Sent from the drools - user mailing list archive at Nabble.com.
More information about the rules-users
mailing list