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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple PowerPlay Macro

Status
Not open for further replies.

lmorgansky

IS-IT--Management
Jul 9, 2002
15
US
I am trying to create a simple PowerPlay macro that opens a report, changes in the dimension filter, and saves as a PDF. I have tried the simple example in the documentation, but I continue to get the error:

R440 "PowerPlay: The macro could not find the dimension matching passed code."

Here is the code:

Sub Main()
Dim objPPRep as Object
Set objPPRep = GetObject ("C:\test.ppr")
objPPRep.DimensionLine.Item("All Time").Change "2002/Apr"
msgbox(objPPRep.DimensionLine.Item("All Time").Name)
objPPRep.Close
Set objPPRep = Nothing
End Sub

The msgbox appropriately prints out the correct month that the report was last saved (2002/Jun). But the line before this fails.

I have tried both the source value (200204) and the Cognos category code value (20020401-20020430) as the Change parameter with no luck.

Any help is appreciated?

Thanks,
Lonnie
 
Ooops! Answered my own question:

When searching for a dimension using Change, the method does not search up the dimension tree. Thus, to be sure you find what you are looking for you have to navigate to the top of the tree (ChangeToTop) and then execute the Change method with the value you are looking for:

objPPRep.DimensionLine.Item("Dim1").ChangeToTop
objPPRep.DimensionLine.Item("Dim1").Change

Enjoy!

Lonnie Morgan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top