<div dir="ltr"><br> This is a surprise for me, because you should get a compilation error for that. What version of Drools are you using?<br><br> Anyway, you can't do that. When you use "or", Drools will internally create one subrule for each logical branch in your LHS. So, any variable you use in the RHS must be bound in all possible logical branches.<br>
<br> []s<br> Edson<br><br><div class="gmail_quote">2008/8/19 hatzlj <span dir="ltr"><<a href="mailto:hatzl.j@a1.net">hatzl.j@a1.net</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hello everybody,<br>
<br>
on the LHS of my rule i connect several Conditions with OR and have<br>
different variable bindings for this Condition. Now - if any of this<br>
conditions does not fire, i assume that the binding variable is not created,<br>
so I can't access it in the RHS. This results in an null pointer exception<br>
when I call the fireAllRules-Command in my Java Application.<br>
<br>
A simple rule example:<br>
rule "Rule 1"<br>
when<br>
HKT: Parameter(parameterCode = "HKT", value < normalFloor) or<br>
GGT: Parameter(parameterCode = "GGT", value < normalFloor) or<br>
HSR: Parameter(parameterCode = "HSR", value < normalFloor) and<br>
GOT: Parameter(parameterCode = "GOT", value > normalFloor)<br>
<br>
then<br>
System.out.println(HKT.toString();<br>
<br>
end<br>
<br>
So my Question is: Is there any way to check in the RHS wheter the pattern<br>
binding has been created or not or do i have to change the way of writing my<br>
rules (which i do not want to)?<br>
<br>
thanks,<br>
hatzlj<br>
<font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/Check-if-a-pattern-binding-exists-in-the-RHS-tp19032260p19032260.html" target="_blank">http://www.nabble.com/Check-if-a-pattern-binding-exists-in-the-RHS-tp19032260p19032260.html</a><br>
Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>