Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting Rows in PowerPlay

Status
Not open for further replies.

friedpie

MIS
Aug 24, 2003
7
0
0
US
Does anybody know a way to count the rows in a powerplay report?
 
How about ranking? Why would you want to count rows in a PP report? If it's for determining the number of clients (for example), then you could use the category count function inside of Transformer.
 
Plus the advantage of the "rank" window in PP Client is that it shows you the number of rows in the "Show Ordinals" section (the grayed out figure) without having to proceed with the ranking.
If that's too much effort for your user, it should be possible to code a macro that counted rows (or columns) of the current report.
lex


["] Veni, Vidi, Velcro. ["]
 
Following on from the last post, here's a simple macro that uses the count property. Since the property will include totals for Explorer reports in the count, there is a test for the mode to adjust.

'* This macro requires an active PowerPlay report.

Option Explicit

Sub Main
Dim objPPRep As Object
Dim strErrorText As String
Dim ColumnCount As Integer
Dim RowCount As Integer
Dim test
On Error GoTo ErrorMes

Set objPPRep = GetObject(,"CognosPowerPlay.Report")
Test = objPPRep.ExplorerMode
ColumnCount = objPPRep.Columns.Count
RowCount = objPPRep.Rows.Count
If test = -1 then ColumnCount = ColumnCount -1
If test = -1 then RowCount = RowCount -1
MsgBox "The open report has " & ColumnCount & " columns and " & _
RowCount & " rows."

done:
Exit Sub

ErrorMes:
strErrorText = "The following error occurred at line " & Erl & "." & _
Chr$(13) & Chr$(13) & Chr$(9) & Err & " " & Error
If Err = 429 Then
MsgBox strErrorText & Chr$(13) & Chr$(13) & "Please ensure that " & _
"a PowerPlay report is active before running the macro."
Else
MsgBox strErrorText
End If
Resume done

End Sub

["] Veni, Vidi, Velcro. ["]
 
flex13 - I do not want to make changes to the model; therefore the requirement for counts in PowerPlay.

drlex - thanks for the script. I need the counts to actually be in the PowerPlay report though.

Thank you both for your assistance. :eek:)
 
Create a "calculated" column in your .imr (that you save as an .iqd) report called "NBR". Make it a 'number' value of 1.
Use the column "NBR" as a measure.
It will be the count of the number of rows for that related dimension/category in your cube.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top