Workflow - Working with Variables
Workflow allows you to parameterize the settings of each component in the flow and make decisions optional using variables:
There are 3 different types of variables:
- Keywords: User data generated from XML, JSON, XLSX, CSV, Database or RegEx
- Job XPaths: Data stored in the job, being the results of previous steps or result of the injection of XML or JSON.
- Meta: Meta data information about the documents associated with the job.
In the "Variable" tab of each component you can specify which items to override with a variable. When nothing is specified then the value of the "Static" tab is taken. The input can be specified using a mix of literal text and variables. Variables conform to the format:
{[Key|Job|Meta]:<name>}
An example for when a variable bleed is wanted and the data is stored under key "Bleed" as millimeters then the format would be:
{Key:Bleed} mm
The above parameter will replace {Key:Bleed} with the value, for example and form "3 mm".
Keywords
Keywords are Key/Value pairs that are stored in the UserData section of the job.
The UserData can be provided as section in the input XML or extract from XLSX, CSV, Databases or from the document filename using RegEx expressions.
XPaths
XPaths identify nodes or attributes in the job its XML structure. This XML structure can be inspected via the XML job. This allows to acces data from earlier steps or data injected with the XML or JSON hotfolder.
Meta data is a list of descriptive data of the first document contained in the job. The variables available are:
- Width : Width of the first page of the first document
- Height : Height of the first page of the first document
Rules based flows
Variables can be used to control the flow of jobs. By double-clicking a connector a filter condition can be added in 2 forms: JavaScript or only the if-clause. The latter makes a simplified decision/filter available without knowing JavaScript in full.
If-clause
Allowing any JavaScript style of condition like:
- == : when the values are equal
- != : when the values are not equal
- < : smaller
- > : larger
- <= : smaller or equal
- >= : larger of equal
The substitution rules as above apply. For example to only allow 3 mm bleed jobs the notations is:
{Key:Bleed} == 3
JavaScript
Full JavaScript with specific extensions to acces the PDF document are allowed. Define a function named "function()" that returns a bool. A JavaScript style function to increase test if the the bleed is larger than 3 and then double it would look like:
function() {
if( Key.Bleed > 3 ) {
Key.Bleed *= 2;
return true;
}
return false;
}
Optional variables
Variables can be made optional by appending a question mark after the type; like Key?. When the keyword is exists it will be used. When the keyword is not defined it will be treated as if it is not defined and use the values from the "Static"-tab.
Parameter types
Parameters can accept the types listed below. The parameter type expected can be observed in the "Variable"-tab by hovering over the edit field, a tooltip with documentation will appear showing the expected type.
- String : any value
- Integer : negative and positive non-fractional numbers
- Real : any number
- Boolean : True or false
- Unit : Dimension or size defined in units (1/18"). See "Dimension modifiers" below.
- Percentage : Percentage, from 0 to 100.
- Path : Operating system specific path or UNC path.
- Enumeration : Any of the values listed in the documenation of the parameter.
Dimension modifiers
Dimensions and sizes are usually defined in the local unit system; imperial or metric. To automatically convert the number into a PrintFactory Unit (1/18") append one of the following modifiers after the parameter definition:
- " : inch
- mm : millimeter
- cm : centimeter
- dm : decimeter
- meters : meter
- pt : point (1/72")
Special keywords
- Copies
- Barcode
Related Articles
Layout automation from structured filenames
Layout automation from structured filenames Layout (as of version 6.3) has 2 preference items tailored for automated flows where manual interaction is required. Typically when Enfocus Switch, Esko Automation engine or another workflow is present. In ...
Creating a new Workflow
To create a new Workflow you first need to open the Workflow application. On a Windows PC, you will find it here: C:\Program Files\PrintFactory, and on macOS, here: HD/Applications/PrintFactory. After opening the application you need to click the ...
Creating Keywords using RegEx
Workflow allows you to parameterize the settings of each component in the flow and make decisions optional using variables. You can read extended information about variables and their format in the article [here]. This article will explain in close ...
Workflow Debug mode
Debug mode can be enabled in your Workflow to enable you to check the Job XML & file at each step in the Workflow. To enable debug mode, right click the Workflow name and click "Enable Debugging" When the debugging is enabled, you will see the little ...
Backing up and Importing a Workflow
For customers sending in a backup of a Workflow for testing, unzip the backup they send you and place in the following folder location: PC: C:\Users\Public\PrintFactory\Workflow Mac: Users/Shared/PrintFactory/Workflow How to backup a Workflow: