[rules-users] how to retract all documents created in the following scenario

vadlam sreeram.vadlamudi at wellsfargo.com
Thu Feb 2 15:59:05 EST 2012


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-the-following-scenario-tp3711226p3711226.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list