Visual Basic example

This example illustrates the use of the methods Start, Continue, and Finish to run an interactive ITP Model.

Option Explicit

Dim Model

' An object with the name Model is initiated
Set Model = CreateObject("ITPOLS1.MODEL")

' Some properties are set
Model.Host = "yourITPServerAddress"
Model.Port = yourITPServerPort
Model.JobID         = "your job id"
Model.ApplicationID = "your application id"
Model.Info = "info.xml"
Model.Environment = "Test"
Model.FormVersion = "1"

Dim Result

' The Start method is called. The result of the method is returned ' in the variable Result
Result = Model.Start("model", "result.doc")
' When Result holds the return value 1 (meaning that the Model    ' came across an interact), the Continue method is called with the ' answer to the interact in response.xml
Do While (Result = 1)
  MsgBox "Interact"
  Result = Model.Continue("response.xml", "ok")
Loop

' When Result holds the return value 0 (meaning that the Model has ' been run) the Finish method is called
If Result = 0 Then
  Model.Finish()
' When Result holds the return value 2 (meaning that an error ' occurred), a reference to the .xml error file is shown is a ' message box.
ElseIf Result = 2 Then
  MsgBox "Error data in file: " & Model.Info
End If