On Mon, Nov 16, 2009 at 7:16 AM, Greg Barton <span dir="ltr">&lt;<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The answer to both questions is basically the same: use the &quot;this&quot; reference.<br>
<div class="im"><br>
rule CheckValidBinNumber<br>
when<br>
   $br:BillingRecord(cardNo!=null || cardNo!=&quot;&quot;)<br></div></blockquote><div><br>This part, taken from the original mail, looks suspicious to me: if cardNo==null, the 2nd term is evaluated and throws a NPE. <br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
</div>   $valid: Boolean(this == false) from checkValidity($br.cardNo)<br>
<div class="im">then<br>
   error(BillingRecordHelper.BIN_NO_INVALID_ERROR,log);<br>
end<br>
<br></div></blockquote></div><br>It would be interesting to learn whether a single CE<br><br>   $br : BillingRecord( cardNo : cardNo, eval( checkNotNullValid( cardNo ) )<br><br>with <br><br>boolean checkNotNullInvalid(Sring cardNo){<br>
    return cardNo != null &amp;&amp; cardNo != &quot;&quot; &amp;&amp; ! checkValidity( cardNo );<br>}<br><br>OR<br><br>    $br : BillingRecord( cardNo : cardNo !=null &amp;&amp; !=&quot;&quot;, eval( ! checkValidity(cardNo) ) )<br>
<br>wouldn&#39;t be (slightly) more efficient.<br><br>-W<br><br>