Anstis, Michael (M.) wrote:
You can't use a bound object as the list against which "contains"
operates.
Guys - think this is bad news for me... I need to use 'contains' keyword as
List comparison against several variables from the primary Fact and possibly
against several Lists. Without the ability to bind variable names to
specific ArrayList objects I don't know how I can do this type of comparison
in my rules - I hope there is a work-around to my problem, otherwise this
may be a deal killer for my project...
What I dont understand is that Edson's example seemed to get me so close -
he gave this example some time in the past, which seems to illustrate that
variable binding to List object is possible. How is his example different
from what I'm trying to do in my code?
Again, this is what I need:
Several Lookup list objects each with many String elements asserted into
memory. One main Fact (GATEIN) asserted into memory as well, the GATEIN
fact has CustNumber, shipper_code, forwarder_code, cosignee_code, etc).
Rule needs to check for existence of one of these codes in ONE or MORE
lookup lists. Something like this:
if (CustomerNumber = "293" and (ShippersList contains shipper_code or
ShipperList contains forwarder_code, or ShipperList contains cosignee_code)
).
Is this possible given the syntax constraints? BTW, I'm using 3.1.0M1
James
Edson's prvious example:
------------------------------------------------
rule "retrieving the list"
when
Customer( $custCode : customer_code )
then
List codes = lookupDAO.getLookup( $custCode );
assert( codes );
end
rule "doing something"
when
Customer( $custCode : customer_code )
$list : List()
SHIPMENT_MOVE(customer_code == $custCode, $sc : ship_code,
$dc : deliver_code, $pc :
port_code,
( $list.containts($sc) ||
$list.containts($dc) || $list.containts($pc) ) )
then
// do something
end
------------------------------------------------
--
View this message in context:
http://www.nabble.com/Struggling-with-Rule-syntax---please-help...-tf3408...
Sent from the drools - user mailing list archive at
Nabble.com.