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:

 

NG2WorkflowErrorFolder0004

 

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

 

NG2WorkflowErrorFolder0005

 

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 error workflow consists of the 3 components below:

 

First the input type:

 

NG2WorkflowErrorFolder0006

 

Now the error workflow is to retrieve the original payload with the Named property to payload component:

 

NG2WorkflowErrorFolder0007

 

And finally the error workflow can save the payload to the error folder with the to filesystem component:

 

NG2WorkflowErrorFolder0008

 

 

The output directory is found with this dynamic Xpath expression:

 

concat(substring-before($interform.input.file.absolute.path,'processing'),'error')

 

It starts with the function, substring-before($interform.input.file.path,'processing') in this function the workflow variable, $interform.input.file.path contains the full path of the file, that InterFormNG2 is currently working on. This can e.g. be C:\ProgramData\InterFormNG2\inbox\processing\Intro_demo.xml.

 

With the substring-before function the path to the left of 'processing' is cut out, which results in this in our example:C:\ProgramData\InterFormNG2\inbox\

 

Finally we need to add the text 'error' at the end with the concat function, which makes the new path: C:\ProgramData\InterFormNG2\inbox\error

 

    • 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 ...
    • 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 ...
    • Spooled files in the workflow

      This section covers all topics concerning automatic processing of spooled files in the InterFormNG2 workflow: •How to monitor an output queue. •Load a sample spooled file in the workflow editor •How to condition the workflow on spooled file ...
    • Workflow examples

      Below you see a list of examples of how to setup a workflow to achieve a specific task: 1.How to move files with processing errors into an error folder. 2.How to create a PDF file and insert it into the input XML file encoded in base64. 3.Examples of ...
    • 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: 1.It is much smaller compared to a setup, that e.g. contains a whole subtree ...