QPR Knowledge Base 2015.1

Open Model and Get Measure Values

Open Model and Get Measure Values

Previous topic Next topic No directory for this topic  

Open Model and Get Measure Values

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 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