QPR Knowledge Base 2017.1

SaveModel

SaveModel

Previous topic Next topic No directory for this topic  

SaveModel

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

 

Saves the active model. If the model is open in read-only mode or it is a new model, name for the file or the model is prompted. If the model is open in read-only mode or it is a new model and UI mode is set to "silent", the operation fails and returns an error code. Error code is returned also if there are no models open when the command is used. With models that use version control the save behavior depends on the settings. If "Save changes to the current version" is selected, SaveModel saves the changes to the current version. In the case "Save as new model version" is selected, a new version is created. If the "Prompt" mode is used, a dialog is displayed asking whether the model should be saved as a new version. Note that in the Prompt mode user interface must not be hidden, since otherwise the function fails.

 

Synopsis:

 

PGModel.SaveModel()

 

Required Rights:

 

None.

 

Return Values:

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

 

RV_SUCCESS

RV_APPLICATION_QUIT_CALLED

RV_MODEL_NOT_OPEN

RV_NOT_CONNECTED_TO_SERVER

RV_VERSION_CHANGED

RV_CANNOT_SAVE_MODEL

RV_CANNOT_WRITE_TO_FILE

RV_CANNOT_OPEN_FILE

RV_UNKNOWN_ERROR

RV_FUNCTION_CANNOT_BE_USED_IN_VALIDATION_SCRIPT

 

Example Procedure:

 

Sub SaveActiveModel

 Dim iResult

 iResult = PGModel.SaveModel()

 If (iResult <> 0) Then

   MsgBox "Saving the model failed: " + PGApplication.GetErrorMessage(iResult)

 End If

End Sub