Please enable JavaScript to view this site.

QPR Knowledge Base 2019.1

Navigation: Developer's Guide > QPR API > The Object Model > QPR Modeling > PGApplication Commands

OpenModel

Scroll Prev Top Next More

Revision history:

Introduced in QPR 7.6.1 SP2

Last changed in QPR 2012.2

 

Opens a file or a server model. With server models you can define whether the model is opened for viewing, editing, or exclusive editing. With server models that use version management you can also specify the version to open.

 

Synopsis:

 

PGApplication.OpenModel(ServerModelPath | ServerModelId | FileModelPath, Parameters, out Model)

 

Parameters:

 

ServerModelPath: Path of the model in the server. String.

ServerModelId: ID of the server model. Integer.

FileModelPath: Path of the file model. String.

Parameters: A semicolon-separated list of parameters. The following parameters are supported:

FileModelPassWord: String. Password required for opening the model (if any).

OpenMode: VIEW | EDIT | EXCLUSIVE. String. The mode used when opening a server model. VIEW = view only, EDIT = open for editing, EXCLUSIVE = open for exclusive editing

FileModel: Boolean. Set this to true if you need to open a file model when a server connection is active. Possible values: true | false, 0 | 1. By default this is false.

Model.Branch: String. Name of the branch where the model should be opened from. This requires that the model uses version management. If this is left empty, the root folder is used.

Model.Version: String. Model version number. The first model in which the version number matches is opened. This can be used together with Model.Branch

Model.Revision: Integer. Model revision number. This parameter overrides both Model.Branch and Model.Version since the revision number is always unique.

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_APPLICATION_QUIT_CALLED

RV_INVALID_PARAMETER

RV_SUCCESS

RV_UNKNOWN_ERROR

RV_CANNOT_OPEN_MODEL

RV_CANCELLED

RV_CANNOT_OPEN_ANOTHER_SCRIPT_FILE_FROM_SCRIPT

RV_LOGIN_FAILED

RV_NOT_CONNECTED_TO_SERVER

RV_CANNOT_CONNECT_TO_SERVER

RV_NOT_AUTHENTICATED

RV_ERROR_IN_MODEL

RV_CANNOT_RESERVE_MODEL

RV_CANNOT_CLOSE_MODEL

RV_MODEL_DOES_NOT_EXIST

RV_NO_RIGHTS_TO_MODEL

RV_UNSUPPORTED_FILE_TYPE

RV_CANNOT_OPEN_FILE

RV_CANNOT_READ_FROM_FILE

RV_UNSUPPORTED_FILE_TYPE

RV_UNSUPPORTED_FILE_VERSION

RV_FUNCTION_CANNOT_BE_USED_IN_VALIDATION_SCRIPT

 

Example Procedure:

 

'Open the Dentorex Group model from the server for exclusive editing

iResult = PGApplication.OpenModel("\\Dentorex - Quality Management System", "OpenMode=EXCLUSIVE", oModel)