Sample print flow: delete data file
This topic describes a sample print flow that generates paginated print output for XML data using the OL Connect all in one node and deletes the input file.
Note: This sample flow is provided by OL Connect Automate, once installed. It appears in the flows folder in the Import dialog in Node-RED which allows you to import the sample into a new or existing flow; see Importing and Exporting Flows in the Node-RED documentation. Instructions are given in this topic, but can also be found in the Read me comment that comes with the sample flow.
For a list of all sample flows, see Sample flows.
The all in one node executes the following tasks:
-
It extracts data from a data file. This requires a data mapping configuration, and a data file of course. (Data mapping configurations are made with the DataMapper, which is included in OL Connect Designer. See Data mapping configurations.)
-
It merges the data with an OL Connect template, producing Print Content Items. (Templates are made with OL Connect Designer. See Templates.)
-
It turns a set of Print Content Items into a print job. Any job settings (for sorting, filtering, and/or grouping) are passed on via a Job Preset which is made with OL Connect Designer. (Job Presets are made with OL Connect Designer. See Job Presets.)
-
Finally the node generates the actual output file(s) and stores them in the File Store. Any settings that it needs are passed on via an Output Preset which is made with OL Connect Designer. (Output Presets are made with OL Connect Designer. See Output Presets.)
Prerequisites
Before running the sample flow:
-
Download the following resources and deploy them to the OL Connect Server using the Send to Server option in OL Connect Designer (see Sending files to Connect Server or to another server):
-
In the settings of the all in one node, select the OL Connect Server to which the resources have been sent.
-
Create the following directories in the root of your drive:
\workspace\all in one\in delete input
\workspace\all in one\out
-
Download the following data files and save them in the
\workspace\all in one
directory.
A print flow that deletes the input file
This example flow illustrates a technique to delete the input file.
The flow consists of two parts. The inject flow copies sample data to the monitored folder of the main flow. This prevents sample data from being deleted.
Subsequently the file operations node is used to delete the data file on success and on error. Possible errors are trapped with a catch node. This branch could also be used to notify the admin, for example by sending an email.