Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-1169

PredicateConstraint and/or MVEL Constraint issue?

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.0.1
    • Fix Version/s: 4.0.2
    • Component/s: None
    • Labels:
      None
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      I was able to work around this issue by using an eval column (not sure if the right terminology) invoking a java function that encapsulates the composite logic operation.

      rule (1)
      when
      a: Criteria(
      $a : this
      )

      b: Criteria(
      $b : this
      )

      eval( FN.criteriaMatch($a, $b) )
      then
      ...
      end

      Show
      I was able to work around this issue by using an eval column (not sure if the right terminology) invoking a java function that encapsulates the composite logic operation. rule (1) when a: Criteria( $a : this ) b: Criteria( $b : this ) eval( FN.criteriaMatch($a, $b) ) then ... end

      Description

      Consider the following rules:

      rule (1)
      when
      a: Criteria(
      $criteriaA : criteriaA,
      $criteriaB : criteriaB
      )

      b: Criteria(
      matchCriteriaA == true && criteriaA == $criteriaA

      matchCriteriaB == true && criteriaB == $criteriaB
      )
      then
      ...
      end

      rule (2)
      when
      a: Criteria(
      $criteriaA : criteriaA,
      $criteriaB : criteriaB
      )

      b: Criteria(
      eval(
      matchCriteriaA == true && criteriaA == $criteriaA

      matchCriteriaB == true && criteriaB == $criteriaB
      )
      )
      then
      ...
      end

      I am seeing different behavior for the same test cases. I am basically inserting
      "a" and "b" with matching criteriaA and criteriaB and I am testing different
      combinations of matchCriteriaA and matchCriteriaB (i.e. F/F, F/T, T/F, T/T).

      Results for rule (1):
      F/F -> rule activated (incorrect)
      T/F -> rule activated (correct)
      F/T -> rule activated (correct)

      Results for rule (2):
      F/F -> rule activated (incorrect)
      T/F -> rule activated (correct)
      F/T -> rule activated (correct)

      I also tried an eval column (now a snippet based on the actual rule I ran):

      eval(
      ($t_matchDvpAccount == true && $t_accountCode == $c_accountCode)

      ($t_matchPartialAccount == true && $t_accountCode5 == $c_accountCode5)
      ($t_matchClientAccount == true && $t_clientAccountCode == $c_accountCode)
      ($t_matchNoAccount == true)
      )

      And with the following data (took while debugging the evaluation):

      $t_matchClientAccount Boolean (id=176) value false
      $t_accountCode "123450ACCT"
      $t_matchDvpAccount Boolean (id=176) value false
      $t_matchPartialAccount Boolean (id=191) value true
      $t_clientAccountCode "12345CACCT"
      $c_accountCode5 "12345"
      $t_accountCode5 "12345"
      $t_matchNoAccount Boolean (id=176) value false

      The evaluation returns false.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                tirelli Edson Tirelli
                Reporter:
                ydewit Yuri de Wit
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: