Sample print flows: capture data
This topic describes a sample print flow that generates paginated print output for XML data using the OL Connect all in one node.
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
\workspace\all in one\out
-
Download the following data files and save them in the
\workspace\all in one
directory.
A standard print flow using the all in one node
In its simplest form, a print flow may consist of a node that captures a data file, such as a folder capture node or read file node, the all in one node, and a node to save the result to disk.
This flow is triggered by adding an XML file to the folder monitored by the folder capture node. This node writes the path to the data file in msg.filename
. Additional information on the data file is stored in msg.file
.
The flow also has two inject nodes for testing. Provide a hard-coded path to a data file in msg.filename
. Then use the inject node to trigger the process with that data file.
Tip: Adding multiple inject nodes to your flow is a great way to test the flow with data files of different sizes.
The flow uses the write file node to store the print output file to disk. The print output file, a zip archive containing all documents, is written to workspace\all in one\output.zip
.
Dynamic output file name
The change node in this example uses information stored in msg.file
to construct a dynamic output file name based on the name of the data file.