Delete field region using custom processing stage in ABBYY flexicapture


Let's say I have a field in my document definition called myField

After recognition and verification, I have a custom stage -document script with the following line. The document enters the stage, but there seems to be a problem in deleting region of myField which got created at the time of verification stage.

Document.Field("Invoice Layout\\myField").Regions[0].Delete();

I get the below error from processing server.

Document 1: Routing script error: System.Runtime.InteropServices.COMException (0x80004005): Cannot modify object data from this script.
at ABBYY.FlexiCapture.IFieldRegion.Delete()
at Main.Execute(IDocument Document, IRoutingRuleResult Result)

Please help!

Была ли эта статья полезной?

Пользователи, считающие этот материал полезным: 0 из 0


Комментариев: 2

  • Avatar
    Adrian Enders

    Basically I always read this error like, "You can't do that here."

    So your only option is to move the script somewhere. I would note that in Developer Help this field object (IFieldRegions ) is "Read only". You may not be able to delete a Region. Have you tried making this a rule on the field in the Doc Def? Another option is an Event Handler. If you still get errors there, you probably can't delete regions.

    Check the Developer Help for the IFieldRegions object information. There are some good notes here, it might lead you down the path to a solution.

  • Avatar
    Archit Agrawal

    Well, that works perfectly fine when I put this script within a document definition under a specific field. I have used Context rather than Document this time. But I want to make this work within a custom processing stage between export and training stage. The script should get rid of the custom regions created by verification agents once the export is done.


Войдите в службу, чтобы оставить комментарий.