Workflow: How to move files into an error folder

Workflow: How to move files into an error folder

When InterformNG2 is processing files from a folder, then it will process the input files like so:

    NG2WorkflowErrorFolder0001

 

The files are moved into the processing folder, when InterformNG2 starts to process the files, and they are moved into the processed folder, when they have been processed, no matter if the processing ended in error or not.

 

You might prefer, that InterformNG2 should work like this:

 

That the files are moved into different sub-folders depending on if an error was found or not. In this way only successfully processed files are moved into the processed folder, while files that hit an error are moved into an error folder like below:

    NG2WorkflowErrorFolder0002

 

You can achieve the above, if you setup the main workflow and an error workflow like shown below:

(On the main workflow we setup a reference to the error workflow, which is shown below).

    NG2WorkflowErrorFolder0003

 

This is all described in the video below, but the details are also covered below the video:



 

You need to setup both the main workflow and the error workflow in a specific manner:

 

The main workflow:

  1. Refer to the error workflow in the header.
  2. Save the input XML file in the payload as a named property.

The error workflow

  1. Restore the XML file to the payload from the named property.
  2. Save the XML file in the error folder via the To filesystem component.

The main workflow
The main workflow can be built up by these components:

 

In the bottom of the first component, Read from file you can refer to the error workflow to call, if an error should occur:

 


 

In the next component you should save the payload to a named property e.g. like below:


 

And then you can continue to setup the workflow as normally. You can even at any time select another error workflow with the component, Error handler.


The error workflow
The main workflow can be built up by these components:

 

In the bottom of the first component, Read from file you can refer to the error workflow to call, if an error should occur:

 


 

In the next component you should save the payload to a named property e.g. like below:


 

And then you can continue to setup the workflow as normally. You can even at any time select another error workflow with the component, Error handler.


    • Related Articles

    • Error handler

      This advanced other workflow component, Error handler, sets which workflow to call if an error should occur during processing. This is similar to the On error workflow on the workflow inputs. An alternative or addition is the general error report ...
    • Workflow examples

      Below you see a list of examples of how to setup a workflow to achieve a specific task: How to move files with processing errors into an error folder. How to create a PDF file and insert it into the input XML file encoded in base64. Examples of how ...
    • Handling large spooled files in parallel

      The processing of spooled files on an output queue is single threaded, so if you are processing larger spooled files (that takes longer to process and print), then smaller spooled files on the same output queue might wait for the processing of a ...
    • Generic workflow

      One of the unique features of the InterformNG2 workflows is the ability to setup very dynamic and generic workflows. There are multiple advantages with a generic workflow: It is much smaller compared to a setup, that e.g. contains a whole subtree for ...
    • Advanced Utilities workflow components

      The Advanced Utilities workflow components are as follows: Append to zip archive. Appends the payload to a zip file. The zip file will be created, if the referenced zip file does not exist. Attachment to payload. Takes a named attachment, removes it ...