Introduced in QPR 8.1
Last changed in QPR 2012.2
Saves the current model to the server or to a file. In addition to regular saving, this command can be used to save the model as a new version, save the model to a branch, or replace a model.
Operation: String. Defines the save operation that is used. Supported operations:
•Save. Saves the current model to the server or to a file in the regular way. In the case the model has version management enabled, the behavior is as follows:
o"Save changes to current version" option is set for the model: Changes are saved to the current version.
o"Save as new model version" option is set for the model: The model is saved as a new version and the version info dialog is displayed. In the case user interface is hidden, the operation fails.
o"Prompt" option is set for the model. A dialog asking whether the model should be saved as a new version is displayed. In the case user interface is hidden, the operation fails.
•SaveAs. Saves the model as a new server or file model. This can be used also to save a server model as a file model and vice versa. In the case the server model name already exists, this operation can be used to save the model as a new version. Supported parameters: ServerModelName, FileName, FileReplace, Password, NewVersion + optional version info parameters
•Replace. Replaces an existing server model with the current model. Functionality is otherwise similar to the ReplaceModel command. The following parameters can be used: ServerModelName, CopyUserRights + optional version info parameters.
•NewVersion. Saves the current model as a new version. Parameters can be used to define version information and branch.
Parameters: String. A semicolon-separated list of parameters for the selected operation. Supported parameters:
•ServerModelName: String. Server path + model name.
•NewVersion: true | false. If this is true and a server model already exists, the model is saved as a new version.
•FileName: String. Path and name of a file model.
•FileReplace: true | false. Defines if a similarly named file model should be replaced.
•Password: String. File model password.
•CopyUserRights: true | false. Defines whether user rights are copied from latest model version in the target model or branch to current model. (Save as new version / Replace)
•KeepOldVersionPublished: true | false. Defines whether the old version remains published in QPR Portal when the model is saved as a new version.
•LockOldVersion: true | false. Defines whether the old version is locked when the model is saved as a new version.
•Status: Integer (enum). Sets the model's version information Status as enumeration index value (integer). Default model enumerations: Draft = 0, Current State = 1, Proposal = 2, Approved = 3, Implemented = 4
•Author: String. Defines the model author (no connection to actual users)
•Comment: String. Comment for the model.
View rights to PGModel.
Below are listed the return values that this function can return:
RV_NOT_ENOUGH_RIGHTS (only admins can set status & author in Save As/NewVersion operations)
iResult = PGModel.SaveModelEx("NewVersion", "Model.Branch=Development")
If (iResult <> 0) Then
MsgBox "Saving the model failed: " + PGApplication.GetErrorMessage(iResult)