QPR Installation Instructions

Change Persons in Charge for Certain Elements

Change Persons in Charge for Certain Elements

Previous topic Next topic  

Change Persons in Charge for Certain Elements

Previous topic Next topic JavaScript is required for the print function  

<QPR_SCRIPT_FILE language = vbscript>

Option Explicit

 

Sub Main()

 

 Dim oModel

 Dim SCError

 

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

   IF SCError <> 0 then Exit Sub 'SCApplication.GetErrorMessage(SCError) could be called

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

   if SCError <> 0 then Exit Sub

 

 Dim Elements 'array of name, id, symbol, scId, scsymbol

 Dim InCharge

 Dim I

 

   SCError=oModel.GetElements("ELEMENT", Elements)

   if SCError <> 0 then Exit Sub

   For I = Lbound(Elements,2) + 1 to Ubound(Elements,2) 'first row has headers

 

     SCError=oModel.GetProperty(Elements(I,1), "InCharge", InCharge)

     If SCError <> 0 then Exit For

     If InCharge="John Smith" then

       SCError=oModel.SetProperty(Elements(I,1), "InCharge", 1) 'User ID must be used here

       If SCError <> 0 then Exit For

     End If

   Next

 

End Sub