On Mon, Nov 16, 2009 at 7:16 AM, Greg Barton <greg_barton@yahoo.com> wrote:
The answer to both questions is basically the same: use the "this" reference.

rule CheckValidBinNumber
when
  $br:BillingRecord(cardNo!=null || cardNo!="")

This part, taken from the original mail, looks suspicious to me: if cardNo==null, the 2nd term is evaluated and throws a NPE.

  $valid: Boolean(this == false) from checkValidity($br.cardNo)
then
  error(BillingRecordHelper.BIN_NO_INVALID_ERROR,log);
end


It would be interesting to learn whether a single CE

   $br : BillingRecord( cardNo : cardNo, eval( checkNotNullValid( cardNo ) )

with

boolean checkNotNullInvalid(Sring cardNo){
    return cardNo != null && cardNo != "" && ! checkValidity( cardNo );
}

OR

    $br : BillingRecord( cardNo : cardNo !=null && !="", eval( ! checkValidity(cardNo) ) )

wouldn't be (slightly) more efficient.

-W