Re: [rules-users] Date arithmetic in “when” session

sridhar123 sridhar.peddinti at sabre.com
Wed May 7 11:30:34 EDT 2008



Ok, finally I am able to solve this puzzle:

	$req : LowFareRequest(
    			$reqTime : requestedDeparture.time)
    	$itr : AirItinerary( discarded == false )
     	$flight : Flight( $depart : departure.time)
       eval (((Long)$depart).longValue() * 2  < 
((Long)$reqTime).longValue() &&  ((Long)$depart).longValue() * 4  > 
((Long)$reqTime).longValue())
   
Thank you all who helped out.

-Sridhar




Christine-27 wrote:
> 
> Hi,
> you shouldn't put part of the "if" or "when" part after the "then". Put
> all conditions after the "when" so the rule engine will evaluate them.
> 
> I guess you mean to write something like (although I haven't tested this):
> 
> rule "ITR Discard"
>    when
>      	req : LowFareRequest(
>              $reqTime : requestedDeparture.time)
>      	itr : AirItinerary( discarded == false )
>       	flight : Flight(
>             departure.time - 2 * 3600000 <
>                    $reqTime,
>             departure.time + 4 * 3600000 >
>                    $reqTime)
>    then
>              System.out.println("discard true");
>    end
> 
> 
> Christine
> 
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Re%3A-Date-arithmetic-in--%C3%A2%C2%80%C2%9Cwhen%C3%A2%C2%80%C2%9D-session-tp17103754p17106417.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list