List Info

Thread: Date arithmetic in “when” session




Date arithmetic in “when” session
country flaguser name
United States
2008-05-07 06:20:02
 

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.nabbl
e.com/Date-arithmetic-in-%E2%80%9Cwhen%E2%80%9D-session-tp17
101938p17101938.html
Sent from the drools - user mailing list archive at
Nabble.com.


_______________________________________________
rules-users mailing list
rules-userslists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )