I am trying to subtract hours from date and compare with another date with
in "when" section, subtracting any value from date giving me compilation
errors. Only the way i could achive this writing drl file as:
dialect "java"
// Rule: Flight.departure – 2 hours < LowFareRequest.departure
// > Flight.departure + 4 hours
// then set AirItinerary.discarded = true
rule "ITR Discard"
when
$req : LowFareRequest()
$itr : AirItinerary( discarded == false )
$flight : Flight()
then
if((($flight.getDeparture().getTime() - 2 * 3600000)
< $req.getRequestedDeparture().getTime())
&&
($req.getRequestedDeparture().getTime()
$flight.getDeparture().getTime() + 4 * 3600000))
System.out.println("discard true");
else
System.out.println("discard false");
end
I am new user to drools, executing if with in then session nullifies when
clause.
how else i can do the above?
TIA
--
View this message in context:
http://www.nabble.com/Date-arithmetic-in-%E2%80%9Cwhen%E2%80%9D-session-t...
Sent from the drools - user mailing list archive at
Nabble.com.