[rules-users] How to check if a property IS null ?

Michael Anstis michael.anstis at gmail.com
Wed Aug 15 15:01:11 EDT 2012


Hi,

I assume you mean Drools DRL (DSL is something different and none of your
examples suggest use of this so far).

How about checking for the absence of the Double instead of it being null:-

when
    $product : Product( )
    not Double( ) from bookingService.getQty( $product )

I've not tried it personally.

With kind regards,

Mike

On 15 August 2012 19:54, Hendy Irawan <hendy at soluvas.com> wrote:

> Thank you.
>
> "this == null" is weird indeed in Java, but I honestly don't know how to
> express this expression in Drools DSL.
>
> A more realistic rule would be:
>
> when
>     $product : Product( )
>     Double( this == null ) from bookingService.getQty( $product )
>
> So what I want to do is detect when a method call returns null. The method
> call can contain parameters but it can be a simple method like before.
>
> How to do this?
>
> Thank you.
>
> Hendy
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-check-if-a-property-IS-null-tp4019014p4019155.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120815/e7935fc2/attachment-0001.html 


More information about the rules-users mailing list