rule "createError"
when
not Error()
emptyDoc: Document( field1== null || == (""), field2 == null || ==
("") )
then
Error fact0 = new Error();
fact0.setErrorCode( "code1" );
insert(fact0);
end
rule "retractBadDocs"
when
Error()
$doc: Document()
then
retract( $doc );
end
-W
On 02/02/2012, vadlam <sreeram.vadlamudi(a)wellsfargo.com> wrote:
Hi All,
we have a scenario whereby, several documents are created as part of the
ruleflow. at the end of the ruleflow, if any of the fields in the document
is empty or null, we would like to create a error (only one error) and
retract all the documents so far.
rule "createError"
ruleflow-group "mrHardErrors"
no-loop true
dialect "mvel"
when
emptyDoc : Document( field1== null || == ( "" ) , field2 == null || == (
""
) )
doc : Document( )
then
Error fact0 = new Error();
fact0.setErrorCode( "code1" );
insert(fact0 );
retract( emptyDoc);
end
I see that error is created more than once ( as many as matching documents )
How do we ensure that all documents are retracted and also the error is
created only once ?
--
View this message in context:
http://drools.46999.n3.nabble.com/how-to-retract-all-documents-created-in...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users