1 Reply Latest reply on Nov 10, 2008 2:33 PM by eng1

    drools, globals and lhs method calls

    eng1

      hi. i'm using drools for the first time and i'm running into a problem using a global in the lhs. here's the situation

      i have a service object set as a global
      i want to call a method on this object that returns a boolean
      i can use it in the rhs no problem but in the lhs i get compilation errors

      so for example, i can do this no problem:

      rule checkExistingSub
      when
      $s : SubscriberModel()
      $c : CollectiveModel()
      then
      collectiveService.isMember($s, $c);
      end

      however when i try this:
      rule checkExistingSub
      when
      $s : SubscriberModel()
      $c : CollectiveModel()
      collectiveService.isMember($s, $c);
      then
      end
      i get this:
      [23,29]: unknown:23:29 Unexpected token '$s'

      i've experimented a bit but just can't get it to work. so my questions are:

      is this possible?
      if so, what am i missing?

        • 1. Re: drools, globals and lhs method calls
          eng1

          for any body interested, wrapping the service call in eval() works like so:

          rule checkExistingSub
          when
          $s : SubscriberModel()
          $c : CollectiveModel()
          eval (collectiveService.isMember($s, $c));
          then
          end

          pretty sure i had tried this before posting but guess not