QPR Knowledge Base 2017.1

Create Model from Scratch

Create Model from Scratch

Previous topic Next topic No directory for this topic  

Create Model from Scratch

Previous topic Next topic Topic directory requires JavaScript Mail us feedback on this topic!  

<QPR_SCRIPT_FILE language = vbscript>

Option Explicit

 

Sub Main()

 Dim oModel

 Dim SCError

 

 SCError=SCApplication.Authenticate("qpr", "demo","")

 If SCError <> 0 then

   MsgBox "Error: " +  SCApplication.GetErrorMessage(SCError)

   Exit Sub

 End If

 SCError=SCApplication.CreateModel("ScriptTest", "Dentorex Group Scorecard", oModel)

 If SCError <> 0 then

   MsgBox "Error: " +  SCApplication.GetErrorMessage(SCError)

   Exit Sub

 End If

 

 Dim RootSCId

 

 SCError=oModel.CreateScorecard("CompanyX Top Scorecard", "", 0, RootSCId)

 If SCError <> 0 then

   MsgBox "Error: " +  SCApplication.GetErrorMessage(SCError)

   Exit Sub

 End If

 

 Dim SCId

 

 SCError=oModel.CreateScorecard("CompanyX Sales", "", RootSCId, SCId)

 If SCError <> 0 then

   MsgBox "Error: " +  SCApplication.GetErrorMessage(SCError)

   Exit Sub

 End If

 

 Dim PerspectiveId

 

 SCError=oModel.CreateElement(44307, "Human", "", SCId, 0, PerspectiveId)

 If SCError <> 0 then

   MsgBox "Error: " +  SCApplication.GetErrorMessage(SCError)

   Exit Sub

 End If

 

 Dim CSFId

 

 SCError=oModel.CreateElement(806347552, "Human CSF", "", SCId,PerspectiveId, CSFId)

 If SCError <> 0 then

   MsgBox "Error: " +  SCApplication.GetErrorMessage(SCError)

   Exit Sub

 End If

 

 Dim MeaId, Id, plId, uId

 

 SCError=oModel.CreateElement(1, "Happy index", "MEA_HappyIdx", SCId, CSFId, MeaId)

 If SCError <> 0 then

   MsgBox "Error: " +  SCApplication.GetErrorMessage(SCError)

   Exit Sub

 End If

 SCError=oModel.SetProperty(MeaId, "Description", "Project manager counts all smiles of project members on a daily basis. Smile must last at least 5 seconds")

 If SCError <> 0 then

   MsgBox "Error: " +  SCApplication.GetErrorMessage(SCError)

   Exit Sub

 End If

 

'

' Insert here a function to get the Id of the desired value settings from the model

'

 

 SCError=oModel.SetProperty(MeaId, "ValueSettingId", Id)

 'If SCError <> 0 then Exit Sub

 

'

' Insert here a function to get the Id of the desired period level from the model

' to the plId variant

'

 

 SCError=oModel.SetProperty(MeaId, "PeriodLevelId", plId)

 If SCError <> 0 then

   MsgBox "Error: " +  SCApplication.GetErrorMessage(SCError)

   Exit Sub

 End If

 SCError=oModel.SetProperty(MeaId, "Unit", "Index")

 'If SCError <> 0 then Exit Sub

'

' Insert here a function to get the Id of the desired in charge user Id from the

' model to the uId variant

'

 SCError=oModel.SetProperty(MeaId, "InCharge", uId)

 'If SCError <> 0 then Exit Sub

 

 Dim Values

 

'

' Insert here a function to fill the Values array with values

'

 SCError=oModel.SetValues (MeaId, Values)

 'If SCError <> 0 then Exit Sub

 SCApplication.Quit()

 

End Sub