Community

IActionResult.Result is null in "after export completed" event Answered

Hi,
My goal is to perform some post-processing on an XML file generated by FC 11. 

My plan is to use a “after export completed” event so that I can examine the IActionResult.Result field to determine where the file was written to.

Questions:

  • 1.     Is this a reasonable way to implement my goal?  That is, should document.Action be non-null in a export completed event?
  • 2.     Is there a better way? 

Please see https://drive.google.com/file/d/0B3v5vAfaHdENTVpGRFNPQzA1OTQ/view?usp=sharing file for code snippet and screen snippets.

Thank you,
Marc

Was this article helpful?

0 out of 0 found this helpful

Comments

3 comments

  • Avatar
    Ekaterina

     Hello,

    Sorry for delay in answering. We've reproduced the issue on our side and discovered in ABBYY internal resources, that it is a known Help bug: IDocument::Action is only available in the export scripts and is read-only.

    As most probably it will result in Help article correction, not in IDocument::Action implementation in post-export, you'll need to find other way of resolving this problem, possibly by writing the Custom Export script. 

    If you describe your goal in more details, we'll try to find a workaround for you.

    0
  • Avatar
    mfeldman

    Hi,
    ABBYY already did supply an answer.    :-)
    The online help for FC12 gave me the information I needed to develop solution shown below.

    The post-export event provides a IDocumentsExportResults.  That provides a IDocumentExportResults.
    That provides a IActionResult, which provides the Result.

    Thx,
    M.

    public void XML2EDI(IDocumentsExportResults exportResults, IProcessingCallback callback) {
                foreach (IDocumentExportResults documentResults in exportResults)
                {
                    msgbox("documentResults: docId=" + documentResults.Document.Id);
                    //System.Diagnostics.Debugger.Break();
                    foreach (IActionResult actionResult in documentResults.OfType<IActionResult>())
                    {
                        String name = actionResult.Name;
                        bool applied = actionResult.Applied;
                        String filename = actionResult.Result;
                        msgbox("\tname=" + name);
                        msgbox("\tapplied=" + applied.ToString());
                        msgbox("\tfilename=" + filename);
                    }
                }
            }


    documentResults: docId=3
        name=Export to data files
        applied=True
        filename=C:\Users\marc\Documents\FlexiCapture11LocalProjects\Export\TestBatch\Data_00000003_16.xml
    1
  • Avatar
    yaodan

    hi,

    i got the same error today both in event or in export script, IActionResult.Result always reply me null 

    • here is my test code in export script,
    Processing.ReportError("start");

    string exportResult = Document.Action.Result;

    if(exportResult==null||exportResult=="") Processing.ReportError("0");

    it printed "start"and "0" in message box

    • here is my test code in event script,
    Processing.ReportError("start");
    string exportResult = ExportResults[0].Document.Action.Result;
    if(exportResult==""||exportResult==null)    Processing.ReportError("exportResult==null");

    it printed "start" and NullReferenceException in message box.

    any help please

    0

Please sign in to leave a comment.