Please enable JavaScript to view this site.

InterFormNG2 Manual

The example below shows how you can build an NG2CMD command, that selects an input XML file, a template to merge with and the path and file name of an output PDF file.

 

The relationship between the parameters of the command and the workflow variables are listed in the section, Parameters of the AS400 command.

 

First we need to build the workflow (based on the AS400 command input):

 

The first element of the workflow is the input selection, which is shown below:

 

NG2CommandExampleXML2PDF0001

 

In the image above we have chosen the identification (path) to be PDF_XML. This is the important link between the CL command and the workflow. We set the input type to XML as we expect the command to refer to an XML file.

 

The next element in the workflow loads the selected XML file from the file system (IFS) into the payload of the workflow:

 

NG2CommandExampleXML2PDF0002

 

This is the file to payload workflow component. In this example we refer to the workflow variable, interform.input.file.absolute.path. This variable relates to the parameter, INFILE of the NG2CMD command.

 

The final workflow component creates the PDF file. For that we use the workflow component, Create PDF file. Here we use the component with these parameters:

 

NG2CommandExampleXML2PDF0003

 

In this component we refer to these variables:

 

Template

This is the template (or design), that we want to merge the input XML file with. Here we have chosen that the template (the design) is to be selected on the command, NG2CMD. The variable, com.interform400.xml.Template contains the value of the parameter, TEMPLATE of the NG2CMD command.

 

Output directory

This is the directory in which we want to store the PDF file, that is created by the merge between the input XML file and the referenced template. Here we refer to the variable, $interform.plugin.archiver.folderName, which contains the value of the parameter, DIR in the NG2CMD command.

 

Output filename

This is the name of the PDF file (without the path but including the extension), that we want to create. This is here the variable, interform.plugin.archiver.fileName, which contains the value of the parameter, OUTFILE in the NG2CMD command.

 

Filename conflict resolution

Here we have specified, that the output PDF file is to be overwritten, if it already exists, but this can also be set via an XPath expression.

 

 

With the setup above we can now call this workflow in InterFormNG2 with the command, IFORMNG2/NG2CMD.

 

This is an example where this command is called in a CL program:

 

/* Create the PDF file via the command.                                 */ 

/* The command refers to an input XML file, that is to be merged with a */      

/* template.                                                            */      

PGM                                                                             

             IFORMNG2/NG2CMD COMMAND(PDF_XML) OUTFILE(outfile.pdf) +            

                          DIR('/apf3812home/work') +                            

                          TEMPLATE('Demo_XML.ift') +                            

                          INFILE('/apf3812home/work/Intro_demo.xml')            

ENDPGM                                                                          

 

The command has these parameters:

 

Command

This is the link to the workflow. This must match the path parameter of the AS400 command input component above.

 

Outfile

The name of the PDF file, that we want to create.

 

Dir

The directory in which the PDF file is to be created.

 

Template

The template (design) that the input XML file should be merged with.

 

Infile

The full path of the input XML file, that we want to merge with.