[rules-users] [drools-planner] eval check doesn't provide the expected output

Geoffrey De Smet ge0ffrey.spam at gmail.com
Wed Oct 6 05:08:48 EDT 2010


The statements inside eval() are java statements, not DRL statements.
In java "!=" means "not the same instance" (while in DRL "!=" means "not 
equal").

Try eval(!$roomCurriculumCode.equals($currCode))

HTH :)

With kind regards,
Geoffrey De Smet

Op 06-10-10 07:09, Joshua Daniel schreef:
> Hi,
>
> I have the following rule and roomCurriculumCode and currCode are of
> type String. If the check is equals "insertLogical" never happens, but
> if the the codes are not equal as expressed below the "insertLogical" is
> performed even if the strings are equal. What am I missing here
>
>      rule "RoomAndCurriculum"
>      when
>      $room : Room($roomCode : code, $roomCapacity : capacity,
> $roomCurriculumCode : curriculumCode);
>      $curriculum : Curriculum($currCode : code);
>      eval($roomCurriculumCode != $currCode)
>      then
>      insertLogical(new IntConstraintOccurrence("RoomAndCurriculum",
> ConstraintType.NEGATIVE_HARD, 1, $roomCapacity, $room, $currCode,
> $roomCurriculumCode));
>      end
>
> -jd
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list