Error handling

We advise to use the ITPError error handler to handle ITPRun errors.

Usage
ITPRun 
Model("model by name")
Result("result document path, name and extension")

The following section is optional. Keys and extras are expected in a certain order from top to bottom in a model. The order in which they are listed here must be the same. Note that it is possible to pass an empty value; value 2 of the Keys below is empty as is value 3 of the extras Set up keys and extras: this script does NOT support parameter files. Keys and extras must be provided as a list of values, separated by semicolons.

      Keys("value1;;value3;value4") 
Extras("value1;value2;;")
DisablePostIncludes (True or False)
Environment ("name of the environment")

The MetaData parameter is optional. It specifies the name of an XML file to store model run meta data into.

MetaData ("xmlfilename")

The following optional parameters can be used to specify a user name and password to be used to retrieve data in the model's run.

     DBUserID("...")
DBPassword("...")

The following section is AS/400 only and optional. See also AS/400 Connection parameters below.

PreCMD("…")
OnSuccessCMD("…")
OnFailureCMD("…")
PostCMD("…")

;

Note

Closing semicolon is required.

Parameters

Model: Required, string.
The model name without the .itp extension. No path should be given, models are always located in the folder Models of the folder ITPWORK within an ITP/Server setup.

However, if a model cannot be placed in the folder Models an absolute path can be used. Note that in a multi machine setup the ITP Model must be accessible using the path passed on all machines. This means either placing the ITP Model on all machines in the path specified or sharing the location of the model on a machine and passing an UNC path.

Result: Required, string.
Path, name and extension of the result document. What the format of the result document is depends on the model document used to create the model. If this was a Microsoft Word document (.doc), the result document will be a Microsoft Word document.
Strictly speaking the path is optional, if no path is provided ITP will write the result document in the system folder Temp.

Keys: Optional, string.
Keys are used to specify parameters for the data retrieval of an ITP Model.

An ITP Model uses data retrieval statements to retrieve required data from external sources, such as the name and address of the intended recipient of a document. Data retrieval statements are parameterized; the parameters are used to identify exactly which data should be retrieved, for instance the customer number of the intended recipient. The parameter Keys to the command ITPRun can be used to specify such data retrieval parameters. Keys are passed as a string of values separated by semicolons (;). Each value specifies a single parameter required by a data retrieval statement in the model.

Note that data retrieval parameters that are explicitly specified by using the keyword PAR in the ITP Model language are not taken from the parameter Keys. Values from the parameter Keys are only used when a data retrieval statement in the ITP Model does not explicitly specify a parameter.

The sequence of keys passed in the parameter Keys must be the same as the order in which they are expected in the model. It is possible to specify an empty parameter by following a semicolon with another one (;;). This will ensure that the empty parameter will count in the sequence.

Be aware that the meaning of a Keys entry can differ depending on the data connection that is being used. For database connections, a value Keys typically provides a database primary key value, such as an invoice number, that can be used to retrieve records using a database query. For the XML File connection, a Keys entry specifies the full path to an XML file.

Note

For the XML File connection, XML files can be specified only through the parameter Keys, not as parameters to the data retrieval statements in the ITP Model. For each data retrieval statement that uses a main entry from an XML File DID Module, the next entry in the parameter Keys is used to determine the XML file that is to be used.

Note

The script ITPRun does not support the use of parameter files.

Extras: Optional, string.
Extra parameters are used to pass generic information to an ITP Model that is not necessarily related to data retrieval. You can for example use the extra parameters to switch between optional Text Blocks at run time. Extras are typically used to pass information to the ITP Model that is not available from the database and that cannot be derived from the database data.
Extras are specified as a string of values separated by semicolons (;). The sequence must be the same as the order in which they are expected in the model.

It is possible to specify an empty parameter by following a semicolon with another one (;;). This will ensure that the empty parameter will count in the sequence.

DisablePostIncludes: Optional, boolean.
If set to True, ITP will not perform a post include after the ITP Model has been run. Note that post includes in ITP/Server are performed 'lazy' by default (ITPLAZYPOSTINC=Y).
If set to False (or left empty), ITPRun will use the ITPPOSTINC setting in the itp.cfg to determine if post includes have to be processed.

The default is False.

Environment: Optional, string.
ITP Models are always run in an environment. Here, the name of the environment in which the ITP Model is run can be given. If no environment parameter is given, the default environment will be used to run the ITP Model. If an environment is passed that does not exist, an error is given.

MetaData: Optional, string.
The name of an XML file containing meta data on the model run. It may also be extended by the model. Refer to the ITP/Server Manual chapter Integrating, section Model run XML metadata for more information.
If this parameter is not given, no such file will be generated.

DBUserID: Optional, string.
User account name to be used in retrieving data from a database. This parameter allows you to specify a database user account per model run.

DBPassword: Optional, string.
Password belonging to the account ID specified in DBUserID.

The next parameters are AS/400 only

PreCMD: Optional, string.
The command Pre is executed after the library list is set.

OnSuccessCMD: Optional, string.
The command OnSuccess is executed if the model is completed successfully.

OnFailureCMD: Optional, string.
The command OnFailure is executed if the model failed.

PostCMD: Optional, string.
The Post command is executed at the end of the run (after OnSuccess or OnFailure).