QPR Knowledge Base 2019.1

CloseModel

CloseModel

Previous topic Next topic  

CloseModel

Previous topic Next topic  

Revision history:

Introduced in QPR 7.2.1

Last changed in QPR 2012.2

 

Closes an open model. You can define whether the changes should be saved.

 

Synopsis:

 

PGModel.CloseModel(Save | No Save)

 

Parameters:

 

Save (1): Save possible changes to the model before closing

No Save (0): Do not save changes even if the model was changed.

 

Required Rights:

 

None.

 

Return Values:

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

 

RV_SUCCESS

RV_APPLICATION_QUIT_CALLED

RV_CANNOT_CLOSE_MODEL

RV_FUNCTION_CANNOT_BE_USED_IN_VALIDATION_SCRIPT

 

Example Procedure:

 

Sub CreateAndSaveFileModels()

 Dim iResult

 Dim oModel

 iResult = PGApplication.CreateModel(True, "", oModel)

 If (iResult <> 0) Then

   MsgBox "Create file model 1 failed: " + PGApplication.GetErrorMessage(iResult)

 End If

 

 iResult = oModel.SaveFileModelAs("C:\Temp\Scripting\DefaultSettings.qprdam")

 If (iResult <> 0) Then

   MsgBox "Save file model 1 as failed: " + PGApplication.GetErrorMessage(iResult)

 End If

 

 iResult = oModel.CloseModel(1)

 If (iResult <> 0) Then

   MsgBox "Close file model 1 failed: " + PGApplication.GetErrorMessage(iResult)

 End If

 Set oModel = Nothing

End Sub