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

Change Cube

Status
Not open for further replies.

bebbo1986

Programmer
Feb 12, 2008
43
DE
Hallo,
I open a PowerPlay (version 7.3) report via VBA and now I ask myself is the a chance to change the cube from with the report gets his data.
There exists the property
PowerPlayRep.CubeName
but this is only for reading and not for writing. But I need exactly this method for writing. Of course the new cube would have the same structure as the old one only with newer data.

Thanks for any help.
 
Have a look at "Open Method (Report)" in the Cognos Script help file or the Cognos documentation, which describes the syntax required for specifying a cube to open a report against.

soi la, soi carré
 
Thanks for your answer. I look in the documentation and there I found exactly what I need, but it wouldn't work.
I tried this code:

Set objPPRep = CreateObject("CognosPowerPlay.Report")
objPPRep.Open Path, Cube

But there seems to be a problem with "CognosPowerPlay.Report" at the error this is marked. Whenn I use "CognosPowerPlay.Application" I can work with the object, but then the Open-Method is not possible.

What can I do?
 
What is the error showing?

Here is a simple version that can be stepped through with F8 in the script editor, requiring a report and cube at the root of C. Should work in VBA.

Code:
Sub Main()
   Dim objPPRep as Object
   Set objPPRep = CreateObject("CognosPowerPlay.Report")
   objPPRep.Open "C:\report.ppr", "C:\cube.mdc"
   objPPRep.Visible = 1
   objPPRep.Close
   Set objPPRep = Nothing
End Sub

soi la, soi carré
 
Thanks for your answer but here opens the same error message as usual.

Laufzeitfehler '-2147024894 (80070002)':

Automatisierungsfehler
Das System kann die angegebene Datei nicht finden.

Sorry it's in German but I can try to translate for you:
runtime error '-2147024894 (80070002)':
automating error
system can't find the stated file.

And the row that is causing this error (yellow) is:
Set objPPRep = CreateObject("CognosPowerPlay.Report")

What can I do?
 
Hmmm,
It works for me in Cognos Script Editor and also in the Visual Basic Editor within Excel (I don't have VB Studio).
Have a look at the emboldened code in Jamguy's code in thread401-1372765 - it's VBA script to open a PP report.
I can't offer anymore help on this, as it sounds more of a VBA issue.


soi la, soi carré
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top