[rules-users] How to initialze a query parameter or set an empty list

ismaximum mnrz57 at gmail.com
Tue Feb 18 22:31:38 EST 2014


Hi all

So I have this query:

query listPrimaryBenefits(List primaries)
    RuleInsuranceSubtype($subtypeId := id, riderFlag != "Y")  and 
    primaries := List() from collect (InsuranceCover(benefitTypeId ==
$subtypeId, topup == Boolean.FALSE))
end


outside the query and within my rule I have this checking:

rule "Test rule"
when
  listPrimaryBenefits($primaries;)
  eval($priamries == null || primaries.isEmpty())
then 
  assert XXXX


Now, if there is a RuleInsuranceSubtype in WM with given condition,
everuthing is fine and $primaries is empty and being checked in eval
statement BUT if there is no  RuleInsuranceSubtype in WM with riderFlag as N
(which is a valid scenario) then the whole query returns false and as the
result in the rule, my eval statement won't even get executed and its 'when'
returns false.

How can I prevent this? I tried to put OR but don't know how to set
$primaries to an empty or null value. 

Does anybody know how to do this or have a better solution?

Thanks




--
View this message in context: http://drools.46999.n3.nabble.com/How-to-initialze-a-query-parameter-or-set-an-empty-list-tp4028180.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list