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!

Problems with PowerPlay Object in Cognos Script 1

Status
Not open for further replies.

Recce

Programmer
Aug 28, 2002
425
ZA
Good day,

I am experiencing problems when trying to stop and end PowerPlay as an Object in my Lotus Script. I have posted a piece of script below with which I experience some problems from time to time. Sometimes the PowerPlay process ends perfectly when I run the macro and other times it simply doesn't stop at all. The problem is that there is no pattern in the way that the problem occurs and that makes it difficult to pinpoint where the problem is. Could anyone please have a look at the code or make some suggestions.Thanks



Sub Main()

Dim objPPRep As Object
Dim objPPRes As Object


'******** Making a backup copy of already existing Excel file***************

FileCopy "\\MyPath\MyFile.xls","C:\MyPath\MyFile.xls"
FileCopy "\\MyPath1\MyFile1.xls","C:\MyPath1\MyFile1.xls"


'*********** Taking the .mdc from MyServer and bringing it to MyServer1 **********

FileCopy "\\MyPath\MyFile.mdc","C:\MyPath\MyFile.mdc"
FileCopy "\\MyPath1\MyFile1.mdc","C:\MyPath1\MyFile1.mdc"


'**************** Creating MyFile.xls **************

Set objPPRep = GetObject("C:\MyPath\MyFile.mdc", "CognosPowerPlay.Report")
objPPRep.SaveAs "\\MyPath\MyFile",4,True

objPPRep.Close

Set objPPRep = Nothing


'*********************** Creating MyFile1.xls **************

Set objPPRep = GetObject("C:\MyPath1\MyFile1.mdc", "CognosPowerPlay.Report")
objPPRep.SaveAs "\\MyPath1\MyFile1",4,True

objPPRep.Close

Set objPPRep = Nothing

End Sub



[pipe] "We know nothing but, that what we know is not the truth..." - Me
 
Hi, me again.

Ok,consider this...it seems like the problem does not lay with PowerPlay but with the Excel.exe object / prcess. When the last Excel file is created then the Excel.exe process doesn't end and this in turn holds onto the Powerplay process. My operating system is Windows 2000 and I monitor the above via Task Manager. Why would this be ? Thx

[pipe] "We know nothing but, that what we know is not the truth..." - Me
 
Hello,
Here is a script that I use to open an impromptu report and save as pdf. Although this uses Impromptu, I suspect they would react in much the same way. Could this be something to do with exiting the PP application.
Let me know if this helps at all.



....
Set objImpApp = CreateObject("CognosImpromptu.Application")
objImpApp.visible FALSE
objImpApp.OpenCatalog (CatPath & CatName), "User class"
Set objImpRep = objImpApp.OpenReport(ReportPath & Report1Name & ".imr")
objImpRep.RetrieveAll
Set objPDFPub = objImpRep.PublishPDF
objPDFPub.Publish (ReportPath & Report1Name & ".pdf")
objImpRep.CloseReport
objImpApp.Quit
Set objImpRep = Nothing
Set objImpApp = Nothing
....
 
Might it be due to your use of GetObject rather than CreateObject? As I understand it, you need to have the cognos application already open for getObject.

soi la, soi carre
 
Good day,

thabrane, thanks for reply.I had a look at it but remember that what you are doing is publishing a report and not SavingAs.As far as I know SaveAs is the only way to create an Excel report from PowerPlay wher as with Impromptu and Transformer you can ExportAs, which is quite handy. Thanks anyway for your input.

drlex, thanks for this.I will try your suggestion cause it sounds as if it could make a difference.

Thanks guys. :)


[pipe] "We know nothing but, that what we know is not the truth..." - Me
 
Hi drlex,

Your suggestion solved my problem. Must say I feel a bit stupid but that is exactly where my problem was. I never created the Object because my reports are not open. Thanks again. [thumbsup2]

[pipe] "We know nothing but, that what we know is not the truth..." - Me
 
Recce,
you're welcome, thank you; glad I could help.
lex

soi la, soi carre
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top