QPR Knowledge Base 2016.1

OpenServerModel

OpenServerModel

Previous topic Next topic No directory for this topic  

OpenServerModel

Previous topic Next topic Topic directory requires JavaScript Mail us feedback on this topic!  

Revision history:

Introduced in QPR 7.2.1

Last changed in QPR 2012.2

 

Opens a server model. Using this commands requires that there is an open server connection available.

 

Synopsis:

 

PGApplication.OpenServerModel(ServerModelPath | ServerModelId, out Model)

 

Parameters:

 

ServerModelPath: Path of the model in the server. String. The path can point at any of the following: root model, model branch, or directly to a model version. In the case a root model or a branch model is specified, the latest version of the root/branch model is opened. In the case also version is specified, that exact version is used.

ServerModelId: ID of the model. Integer. The ID can point at any of the following: root model, model branch, or directly to a model version. In the case a root model or a branch model is specified, the latest version of the root/branch model is opened. In the case also version is specified, that exact version is used. Note that with versioned  models the ID can be either the model ID of the model version or version ID of the model.

out Model: Variant for storing the model that is opened.

 

Required Rights:

 

At least view rights to the model.

 

Return Values:

Below are listed the return values that this function can return:

 

RV_SUCCESS

RV_APPLICATION_QUIT_CALLED

RV_NOT_CONNECTED_TO_SERVER

RV_CANNOT_CLOSE_MODEL

RV_CANCELLED

RV_CANNOT_CONNECT_TO_SERVER

RV_NOT_AUTHENTICATED

RV_LOGIN_FAILED

RV_MODEL_DOES_NOT_EXIST

RV_NO_RIGHTS_TO_MODEL

RV_CANNOT_RESERVE_MODEL

RV_UNKNOWN_ERROR

RV_CANNOT_OPEN_MODEL

RV_FUNCTION_CANNOT_BE_USED_IN_VALIDATION_SCRIPT

 

Example Procedure:

 

Sub OpenDentorexModel()

 Dim iResult

 Dim oModel

 

 Call ConnectToServerAndAuthenticate

 iResult = PGApplication.OpenServerModel("\\Dentorex Group Processes\Drafts\0.3", oModel)

 If (iResult <> 0) Then

   MsgBox "Model opening failed: " + PGApplication.GetErrorMessage(iResult)

 End If

End Sub