hi everyone

need a bit more help here. im currently attempting to write some rules into
my rulesbase and can't seem to get the system to check if a variable is
empty. i have tried using null as shown in the code below


rule "small beak + small body + garden"
        when
        Beak(beak == "small beak", beak = null) &&
        Body(body == "small body")
        Location(location == "garden")
        then 
                ES.resultsmx("<p> );
                ES.resultsmx( Robin </p>");
                ES.resultsop();
end



which dosent work but for some reason i am able to check if it is not null
by doing this


rule "small beak + small body + garden"
        when
        Beak(beak == "small beak", beak != null) &&
        Body(body == "small body")
        Location(location == "garden")
        then 
                ES.resultsmx("<p> );
                ES.resultsmx( Robin </p>");
                ES.resultsop();
end



I have tired using == null but this returns a false and the rule dosent run.
can anyone help me please. Also if anyone has any knowledge of how to write
rules so it only outputs one result instead of repeatedly running the
conditions and outputting results for each correct condition and also how to
check if a string variable contains a substring (within a rule) that would
be greatly appreciated . Thanks in advance

mike
-- 
View this message in context: 
http://www.nabble.com/using-null-in-drools-rulebase-tf3244300.html#a9018648
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to