<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 InChargeToReplace
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
SCError=SCApplication.GetUserId("jsmith", InChargeToReplace) 'User login name must be used here
If SCError <> 0 then Exit For
If InCharge=InChargeToReplace 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