Workflow variable element

Workflow variable element

You can define two kinds of variables in your templates:

  1. A normal  variable, which is defined and used only within the template.
  2. A workflow variable, which can be used for e.g. for sending user defined variable information from the workflow to a template.

This section covers the workflow variables as used inside a template. The workflow variable element can be inserted with this icon:



Alert
The only place where you can define a workflow variable element in the designer is prior to the page element(s), so you should click the template element to add a workflow variable:


 

The workflow variables can be created and updated only in the workflow with the two workflow components:

  1. Set workflow variable
  2. Set multiple workflow variables

Inside the template, you can refer to these workflow variables as input, but you cannot assign a new value to a workflow variable. If you want variables that you can create and update in the template, then you should use the variable element.

 

If you want to refer to a workflow element in a template, then you can simply type the name of the workflow variable with a preceding $-sign, e.g., in XPath expressions.

Alert

Important: A workflow variable is always defined as a string, so if you use such a variable as index in XPath, then you need to cast this as a number e.g. like so:
/Root/Document[number($Index)]/@Company.

Also, if you want to create a counter to keep track of the current number of repeats, then you also need to use the number function when you increment the value e.g., like so:


 

It is, however a good idea to define the workflow variables that you want to use in the template because of this:

  1. It is clear to see, which workflow variables, that the template is using as input, so you should consider to verify, that these variables are setup in the workflows, that are using the template.
  2. You can assign a preview/placeholder value in the designer and in this way directly in the designer see, how the template reacts to varies values of the workflow variable.
The only place where you can define a workflow variable element in the designer is prior to the page element(s), so you should click the template element to add a workflow variable:



Now you can add a new workflow variable with this icon:


 

In the workflow variable element you can let the template know, that a specific workflow variable is expected, and you can also assign a value to be used, when you are designing:


 

In the example above a variable, Copies is set to the value '2'. This can be used by the workflow to request a variable number of copies of the document, and the designer can use the repeat element to produce the same number of repetitions when printing the merged result.

 

So as mentioned above the value '2' set above only has an effect, when you are designing and previewing without a workflow. In production the value is expected to be set in the workflow by either set workflow variable or set multiple workflow variables.

    • Related Articles

    • Variable element

      It is possible to define one or more variables in the InterFormNG2 designer. The advantage is, that you can use variables e.g. to add up all the detail lines of a page and output the page total in the footer. You can also use variables in normal ...
    • Print settings element

      This is relevant for PCL printing only. If you want to select between simplex (print only on the front of the pages) and duplex (print on both front and back) and/or select a specific tray on the printer, then you can use the workflow component, set ...
    • 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 ...
    • Multicast workflow component

      The multicast workflow component can be used, if you want to create multiple outputs from a single input file. You e.g. might want to create a PDF file, an email and a print output from a single input XML file. To do that the multicast component can ...
    • Workflow for old NG templates

      Workflow for old NG templates : Please note - current versions of InterFormNG2 (3.x.x) do not support InterFormNG1 Templates anymore. If you are converting your installation from InterFormNG into InterFormNG2, then you should notice, that the ...