Hi,
First, it would be better if you can use the constraints inside the same
pattern, avoiding subrule generation, instead of using multiple patterns:
Map( this["G250.18"] !=4 && this["G250.4"] not
in("910","990","983","995",
"996","997")
|| this["G250.18"] ==4 && this["G250.4"] in
("910","990","983","995","996","997")
)
Remember that && has precedence over ||, but you can use () if you want
to make it explicit:
Map( ( this["G250.18"] !=4 && this["G250.4"] not
in("910","990","983","995",
"996","997") )
|| ( this["G250.18"] ==4 && this["G250.4"] in
("910","990","983","995","996","997")
) )
Now, answering your question, if you want to negate part of the whole of
the LHS, just use the "not" CE. Example:
rule "ValidationRuleExp_G250.4_0"
when
not (
IValidationField(attributeId =="G250.4") and
Map( this["G250.18"] !=4 && this["G250.4"] not
in("910","990","983","995",
"996","997")
|| this["G250.18"] ==4 && this["G250.4"] in
("910","990","983","995","996","997")
)
)
then
// do something
end
Hope it helps,
Edson
2007/9/18, Gaurav2007 <gaurav.a.joshi(a)capgemini.com>:
Hi All,
My requirment is that i want to send corresponding error when any rule
fails.
for example:
rule "ValidationRuleExp_G250.4_0"
when
IValidationField(attributeId =="G250.4")
(((Map( this["G250.18"] !=4))&&(Map( this["G250.4"]not
in("910","990","983","995","996","997"))))||((Map(
this["G250.18"]
==4))&&(Map( this["G250.4"]
in("910","990","983","995","996","997")))))
then
System.out.println("comming
here---Success-------------------------------------------------->");
end
In this case i can call some method in success,Is there any way so that i
can call some method when any rule fails.
the problem is that i am trying to generate rule file and all the
validation
expressions are already defined.
my task is to evaluate these expression and generate corresponding error
message when any rule fails
can you please suggest me how can i do this using drools.
Thanks,
Gaurav
--
View this message in context:
http://www.nabble.com/how-to-perform-some-task-when-rule-fails.-tf4475301...
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @
www.jboss.com