Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-4902

Can not use mod operators (%) in when clause.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 7.31.0.Final
    • core engine
    • None
    • 2020 Week 01-03 (from Dec 30)
    • NEW
    • NEW

      When I study drools , I write a rule use divide operator

      rule "Buzz" salience 2
       when
        $n: Number( this / 5 == 3 )
       then
        System.out.println("Buzz");
      end
      

      It's OK.

      But:

      rule "Buzz" salience 2
       when
        $n: Number( this % 5 == 0 )
       then
        System.out.println("Buzz");
      end
      

      Report parser error: Unable to Analyse Expression this % 5 == 0:

      The drools document mentioned the same example:

      Person( age > 100 && ( age % 10 == 0 ) )
      % is Multiplicative operators, why parser error?

              mfusco@redhat.com Mario Fusco
              lxbzmy xb l (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: