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

PowerPlay Macro help

Status
Not open for further replies.

Jenk615

MIS
Sep 23, 2003
3
US
Im trying to develop a quick macro to save each of 67 layers into separate PDF files. Take layer one, save to pdf, take layer 2, save to pdf etc..

I took the code directly from the book, what else needs to be added or changed so it only saves one layer instead of all 67?

Sub Main ()
Dim objPDF as Object
Dim objPPRep as Object
Dim objPPApp as Object
Set objPPRep = CreateObject("CognosPowerPlay.Report")
objPPRep.Open( "c:\Cognos\repreport.ppr" )
objPPRep.Visible( TRUE )
Set objPDF = objPPRep.PDFFile( "c:\cognos\PDF-File" , True )
With objPDF
.SaveEntireReport = True
.SetListOfLayersToSave objPPRep.Layers
.SetListOfRowsToSave objPPRep.Rows
.SetChartToSave objPPRep.Graphs.Item(1)
.AxisOnAllPages = True
End With
objPDF.Save
set objPPRep = Nothing
Set objPDF = Nothing
End Sub

Thanks for any help anyone can give..
 
Jenk,
According to the Macro Help file, it ought to work using a subset command oon the "SetListofLayerstoSave" property so that the macro will save a subset of each layer as an individual pdf, with the each layer name as part of the pdf title:

Sub Main ()
DIM X AS INTEGER
DIM STRLAYER AS STRING
Dim objPDF as Object
Dim objPPRep as Object
Dim objPPApp as Object
Set objPPRep = CreateObject("CognosPowerPlay.Report")
objPPRep.Open( "c:\Cognos\repreport.ppr" )
objPPRep.Visible( TRUE )

FOR X = 1 TO OBJPPREP.LAYERS.COUNT
STRLAYER = OBJPPREP.LAYERS.ITEM(X).NAME

Set objPDF = objPPRep.PDFFile( "c:\cognos\PDF-File" + STRLAYER, True )
With objPDF
.SaveEntireReport = True
.SetListOfLayersToSave objPPRep.Layers.SUBSET(X,X)
.SetListOfRowsToSave objPPRep.Rows
.SetChartToSave objPPRep.Graphs.Item(1)
.AxisOnAllPages = True
End With
objPDF.Save
NEXT X
set objPPRep = Nothing
Set objPDF = Nothing
End Sub

(ADDITIONS IN CAPITALS)

However, try as I might, I just can't get it to work on my system (W2K & Ser7MR2) - perhaps it's a bug. Can anyone with a series 6 installation try the code?

frustrated,
lex
 
this code works....I have ver 6.5 installed on my mac...
 
kprit,
thanks; I'll report it via our reseller.

Cognos on a mac? Coooool - is that with Soft PC or Virtual PC? I'd love to get a Powerbook but I need to justify the purchase for work reasons and the lack of a Mac version prevents such. Are you using it to build cubes/impromptu reports or just for reporting?

lex
 
When I run it, it creates 4 PDF's with unique names for 4 different layers, and inside each pdf is all of the information in the report from all 67 layers. It never creates any more than 4 files. In PowerPlay though, you can watch it go through each layer while the macro is running. There are no errors when the macro runs though.

Tried playing around with the code a little bit but still can't get it to save individual layers into different PDF's.
 
on kprit's posting, it works in version 6.5, yet not for me with series 7v1 (script editor is 7.1.29.0 2003-08-15, if you wish to be precise), so on that basis, it looks like a bug :(
anyone else care to pitch in?
lex
 
Yeah, I use V6.61... So not sure why it is not working :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top