Mike,
The implicit connective constraint is AND, so if you write:
when
Beak(beak == "small beak", beak = null)
You are saying:
When beak is "small beak" AND beak is null...
Which will always evaluate to false.
[]s
Edson
mike20043 wrote:
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
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @
www.jboss.com