Start

Refer to Run an interactive ITP Model for a description of the functionality of the Start method.

Method

Function Start (

Model As String,

Result As String,

Keys As String,

Extras As String,

PreCMD As String,

PostCMD As String,

OnSuccessCMD As String,

OnFailureCMD As String,

) As ModelResult

Parameters

Model, specifies the ITP Model that is to be run

Result, specifies the UNC path of the result document. By default, this UNC path is a location relative to the machine on which the API has been installed. In that case, the API will retrieve the document from ITP/Server and store it at this location. The user must ensure that the API is able to write to the location. Also see the DocumentOnServer flag for alternative use.

Keys, keys are used to pass information to an ITP model. You can, for example, use the key to identify the customer for whom you want to create a policy or an invoice. The ITP model can then use the identifying information to retrieve the full customer name and address.
Keys are passed 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.
If the UNC path specified in the Data property contains XML data that should be passed to the ITP Model, the special value *DataURI path can be passed as Keys.
It is possible to specify an empty key by following a semicolon with another one (;;). This will ensure that the empty parameter will count in the sequence.

Extras, extra parameters are used to pass information to an ITP model. You can, for example, use the extra parameters to pass extra information on the user who runs the Model, at run time. Extras are typically used to pass information to the 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.

PreCMD, AS/400 only. The Pre command is executed after the library list is set.

Note

The api user should be aware that this Pre command is executed when the model needs to get data from the database. If the model is set up in such a way that interact statements follow on this data access, the pre command will be executed the first time the data is accessed and every time the Continue call is called.

OnSuccessCMD, AS/400 only. The OnSuccess command is executed if the model is completed successfully.

OnFailureCMD, AS/400 only. The OnFailure command is executed if the model failed.

PostCMD, AS/400 only. The Post command is executed at the end of the run (after OnSuccess or OnFailure).

Note

The API user should be aware that this Post command is executed after every run of the model. This means that the Post command is executed for the Start call and all its Continue calls.

Return values

The following result values are defined for the Start and the Continue method:

ModelResultReady (=0), the Model has been run. The final document has been stored to the location set in the Result property. If the History flag was set, a file with all interact data in XML format has been saved to the location set in the Info property.

ModelResultInteract (=1), an XML file with an interact Form (XForms 1.0) has been saved to the location set in the info property. In addition, if the Preview flag has been set, the partial document has been written to the location set in the Result property.
Examples (keyselection.xml and interact.xml ) of XML data files returned by the Start method in case of key selection or an interact can be found in the COM/API/Example XML Files folder of your ITP/Server installation.
The API user should react to this result by calling Continue with the answers to the interact questions in the Response parameter of the Continue call. The format of the Response parameter must also be in XML (XForms 1.0).
An example (response.xml) of an XML data file that should be passed to the Continue method in case of an interact can be found in the COM/API/Example XML Files folder of your ITP/Server installation.

ModelResultError (=2), an error has occurred. Error info in XML format can be found at the location set in the Info property. This will NOT destroy the session information on the server: a user is still able to go back to a previous interact, and resubmit other interact data.
An example (error.xml) of an XML data file returned by the Start method in case of an error can be found in the COM/API/Example XML Files folder of your ITP/Server installation.