[rules-users] Filtering with Null fields ? (Drools 3)

Maxim Veksler maxim.veksler at gmail.com
Mon Dec 22 09:09:31 EST 2008


Hello List,


In my rules I have something like this :

        // Locate age group(s) subscriber is categorized within.
        eval ($f.getCampaign().getAgeRangeGroups() == null || $subscriberAge
!= null) and AgeRange(lowValue <= $subscriberAge, highValue >=
$subscriberAge, ageRangeCode : code)

This does not work!


What should have been written above is :

1. If Campaign has no AgeRangeGroups() then do not seek AgeRange groups and
simply continue to the next constraint, otherwise -> Campaign has age
groups, now make sure subscriber is not null and then follow on to find all
matching age groups for this subscriber.

How can the above be expressed in the drl file?
I'm having problems both with the NullPointerExceptions and with the logic
not working are requested.

Is using null as the default pass condition is wise? If not could you please
suggest the correct alternative?

Thank you,
Maxim.


-- 
Cheers,
Maxim Veksler

"Free as in Freedom" - Do u GNU ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20081222/b381f29d/attachment.html 


More information about the rules-users mailing list