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

Script for opening and closing several files

Status
Not open for further replies.

jvaneert

MIS
Sep 10, 2002
18
0
0
NL
hello,

Since i am a newbie to CognosScript could someone please provide me with a script that does the following

1. Open a Impromptu report
2. Save this report
3. Save this report as a HotFile
4. Close this report
5. Close the catalog.

This procedure should be done for 5 different files.

Could someone help me on this one?

Regards,

Jules
 
Jules,
you want something like this:
(add extra lines for all reports/hotfiles and watch for line breaks)
lex
---------------------------------------------------

Sub Main()
'variables
Dim x
Dim strfilename(10) as string
Dim strfiledest(10) as string
'objects
Dim objImpApp As object
Dim objImpRep As Object
'
strfilename(1) = "put the path and name of report here with .imr"
strfilename(2) = "and for next one"
'
strfiledest(1) = "put the path and name of hotfile here with .ims"
strfiledest(2) = "etc for all 5 destinations"
'
'Open Impromptu and catalogue
'
Set objImpApp = CreateObject("CognosImpromptu.Application")
objImpApp.Visible 1
objImpApp.OpenCatalog "C:\catalogues\yourcatalogue.cat","Creator",,,,1
'
'loop for report count
'
For x = 1 to 5
Set objImpRep = objImpApp.OpenReport (strfilename(x))
Set objImpRep = objImpApp.ActiveDocument
objImpRep.ExportHotFile strfiledest(x)
objImpRep.CloseReport
Set objImpRep = Nothing
Next x
objImpApp.Quit
Set objImpApp = Nothing
'
End Sub


"Time flies like an arrow, but fruit flies like a banana."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top