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

Christine christine at christine.nl
Wed May 7 10:06:50 EDT 2008


>
> I tried this approach, but I get compilation errors for tokens '-' and '+'
>  I
> get similar errors for any arithmetic symbols (*, + or -)
>
> What is the right way to add or subtract or multiply with in "when"
> session?

I don't know why the example doesn't work. Try this:

rule "ITR Discard"
    when
         req : LowFareRequest(
            $reqTime : requestedDeparture.time)
         itr : AirItinerary( discarded == false )
         flight : Flight(
            departure.time <
                    ($reqTime / 3600000 + 2),
            departure.time  >
                    ($reqTime / 3600000 - 4))
    then
         System.out.println("discard true");
    end



Christine







More information about the rules-users mailing list