[rules-users] Check if a pattern binding exists in the RHS

hatzlj hatzl.j at a1.net
Tue Aug 19 03:11:42 EDT 2008


Hello everybody,

on the LHS of my rule i connect several Conditions with OR and have
different variable bindings for this Condition. Now - if any of this
conditions does not fire, i assume that the binding variable is not created,
so I can't access it in the RHS. This results in an null pointer exception
when I call the fireAllRules-Command in my Java Application.

A simple rule example:
rule "Rule 1"
   when
      HKT: Parameter(parameterCode = "HKT", value < normalFloor) or
      GGT: Parameter(parameterCode = "GGT", value < normalFloor) or
      HSR: Parameter(parameterCode = "HSR", value < normalFloor) and
      GOT: Parameter(parameterCode = "GOT", value > normalFloor)

   then
      System.out.println(HKT.toString();

end

So my Question is: Is there any way to check in the RHS wheter the pattern
binding has been created or not or do i have to change the way of writing my
rules (which i do not want to)?

thanks,
hatzlj
-- 
View this message in context: http://www.nabble.com/Check-if-a-pattern-binding-exists-in-the-RHS-tp19032260p19032260.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list