Please enable JavaScript to view this site.

QPR Knowledge Base 2022.1

Navigation: Developer's Guide > QPR Scripting > Example Scripts

Open Model and Get Measure Values

Scroll Prev Top Next More

<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 Scorecards 'array of id, name, symbol, scId, scsymbol

 Dim ScorecardId

 Dim I

 

 SCError=oModel.GetScorecards(Scorecards)

 if SCError <> 0 then Exit Sub

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

   If Scorecards(I,0)= "Europe Sales Office" then

     ScorecardId= Scorecards(I,1)

     Exit For

   End If

 Next

 

 Dim MeasureValues 'array of measymbol, scsymbol, seriessymbol, periodname, periodStart'periodend, value

 Dim SeriesSymbol

 Dim PeriodId  

 Dim ElementId

 

 ElementId = 0 'get values of all elements

 SeriesSymbol = "" 'get values of all series

 PeriodId = 0 'get values of all periods

 SCError=oModel.GetValues(ElementId, SeriesSymbol, PeriodId, MeasureValues)

 if SCError <> 0 then Exit Sub

 '…do something with the values…

End Sub