Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub Main()
Dim x, y, counter
Dim objPPRep as Object
Dim objPPDim as Object
Set objPPRep = CreateObject("CognosPowerPlay.Report")
objPPRep.New "D:\cubes\Acme sales.mdc", -1
counter = objPPRep.DimensionLine.Count
For x = 1 to counter
MsgBox objPPRep.DimensionLine.Item(x).Name
Set objPPDim = objPPRep.DimensionLine.Item(x)
For y = 1 to objPPDim.Count
MsgBox objPPDim.Children.Item(y).Name
Next y
Next x
objPPRep.Close
Set objPPRep = Nothing
End Sub
Sub Main()
Dim x, y, counter
Dim objPPRep as Object
Dim objPPDim as Object
Dim objPPDimLevel as Object
Dim strLevel as String
Set objPPRep = CreateObject("CognosPowerPlay.Report")
objPPRep.New "D:\cubes\Acme sales.mdc", -1
counter = objPPRep.DimensionLine.Count
For x = 1 to counter-1 'Last dimension is the MEASURES folder
Set objPPDim = objPPRep.DimensionLine.Item(x)
For y = 1 to objPPDim.Levels.Count
Set objPPDimLevel = objPPDim.Levels.Item(y)
strLevel = strLevel & chr$(10) & objPPDimLevel.Name
Set objPPDimLevel = Nothing
Next y
MsgBox "The levels in the " & objPPDim.Name & " dimension are:" & chr$(10) & strLevel
strLevel = ""
Next x
objPPRep.Close
Set objPPRep = Nothing
Set objPPDim = Nothing
Set objPPDimLevel = Nothing
End Sub
Declare Sub getlevels(objPPDim, level)
Dim x
Dim Levelloop(9) as integer
Dim level
Dim objPPRep as Object
Dim objPPDim as Object
Dim objPPMeasure as Object
Dim strItem as String
Dim AuditFile as string
Dim strCube as string
Sub Main
strCube = "E:\cubes\Acme sales.mdc"
AuditFile = "C:\CubeLog.csv"
Open Auditfile For APPEND As #1
Write #1, "Analysing " + strCube
Set objPPRep = CreateObject("CognosPowerPlay.Report")
objPPRep.New "E:\cubes\" + strCube, -1
objPPRep.Visible = 1
For x = 1 to objPPRep.DimensionLine.Count-1 'Last dimension is the MEASURES folder
Set objPPDim = objPPRep.DimensionLine.Item(x)
Write #1, objPPDim.Name & " Dimension"
level = 0
call getlevels(objPPDim, level)
Write #1, Chr$(10)
Next x
Set objPPDim = objPPRep.DimensionLine.Item(objPPRep.DimensionLine.Count)
objPPDim.ChangeToParent
For x = 1 to objPPDim.Children.Count
Set objPPMeasure = objPPDim.Children.Item(x)
Write #1, "Measure " + Cstr(x) + " = " + objPPMeasure.Name
Set objLevel = Nothing
Next x
objPPRep.Close
Set objPPRep = Nothing
Set objPPDim = Nothing
End Sub
'
Sub getlevels(objPPDim, level)
Dim z
Dim objLevel as Object
Set objLevel = objPPDim
If objLevel.Children.Count = 0 then goto skip 'No children, so leave subroutine
level = level + 1
levelloop(level) = objLevel.Children.Count
For z = 1 to levelloop(level)
strItem = objLevel.Children.Item(z).Name
strtext = "Level " + Cstr(level) + " Name: " + objLevel.Level.Name
Write #1, strtext + "; item no." + Cstr(z) + " of " + Cstr(levelloop(level)) + " = " + strItem
objLevel.Change(strItem)
test = 0
If objLevel.IsAlternate = True or objLevel.IsCalculatedCategory = True then test = 1
If test = 0 Then call getlevels(objLevel, level) 'iterate
If test = 1 then Write #1, "Alternate/Calculated/Special - skipping"
If test = 1 then objLevel.ChangeToTop
If test = 1 then level = 1
Next z
level = level - 1
skip: If objLevel.HasParent <> 0 then objLevel.ChangeToParent 'Up a level if required
End Sub
Sub Main
Dim objPPRep as Object
Dim objPPDim as Object
Dim objPPDim2 as Object
Dim strItem as String
'
Set objPPRep = CreateObject("CognosPowerPlay.Report")
objPPRep.New "E:\cubes\Acme sales.mdc", -1
'objPPRep.Visible = 1
Set objPPDim = objPPRep.DimensionLine.Item(1)
Set objPPDim2 = objPPDim
MsgBox "objPPDim is " + ObjPPDim.Name + " and objPPDim2 is " + ObjPPDim2.Name
strItem = objPPDim.Children.Item(1).Name
objPPDim.Change(strItem)
MsgBox "After Change to " + strItem + " on objPPDim, objPPDim is " + ObjPPDim.Name + " and objPPDim2 is " + ObjPPDim2.Name
objPPDim.ChangeToParent
MsgBox "After ChangetoParent on objPPDim, objPPDim is " + ObjPPDim.Name + " and objPPDim2 is " + ObjPPDim2.Name
objPPRep.Close
Set objPPRep = Nothing
Set objPPDim = Nothing
End Sub