QPR Knowledge Base 2015.1

SaveFileModelAs

SaveFileModelAs

Previous topic Next topic No directory for this topic  

SaveFileModelAs

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 a file model with a new name.

 

Synopsis:

 

PGModel.SaveFileModelAs(FilePathName)

 

Parameters:

 

FilePathName: String. New path and name under which the model is saved.

 

Required Rights:

 

Administrator in the case PGModel is a server model.

 

Return Values:

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

 

RV_SUCCESS

RV_APPLICATION_QUIT_CALLED

RV_MODEL_NOT_OPEN

RV_ONLY_ADMINISTRATOR_CAN_SAVE_SERVER_MODEL_AS_FILE_MODEL

RV_CANNOT_OVERWRITE_READ_ONLY_MODEL

RV_FAILED_LOADING_EMBEDDED_DOCUMENTS_FROM_SERVER

RV_ERROR_DURING_SAVE

RV_CANNOT_WRITE_TO_FILE

RV_CANNOT_OPEN_FILE

RV_UNKNOWN_ERROR

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.pmf")

 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