I have an Impromptu report that has two levels,Level and Grouping.
There are 5 levels in the business, and the prompt asks from 0 to 4 which level they want to choose.The Grouping is also chosen from this prompt,but works one back,so if I choose Level 4, then the Grouping would be level 3.
I need to produce PDFs of every category in every level.(I know -they should have Impromptu Web!)
I understand a series of Level category reports would provide the filter values, and a loop would need to run each level report in turn, moving down to the last,saving to PDF as it went.
I have a macro that goes a part of the way:
Dim ImpApp as Object 'Impromptu
Dim ImpRep1 as Object 'Report1
Dim ImpRep2 as Object 'Report2
Dim ImpRep3 as Object
Dim ImpRep4 as Object
Dim ImpRep5 as Object
Dim PdfRep as Object 'Acrobat publisher
'Variables for the catalog and report locations
Dim Catlocn as String
Dim Replocn as String
Dim PDFLoc as String
'Integers to hold the number of rows in report 1 and a running count for report 2
Dim Rcount as Integer
Dim Runnum as Integer
'Set the locations
Catlocn = "\\xserver\Vol2\Data\Cognos\Impromptu\Catalogues\"
ListRep = "\\xserver\Vol2\Data\Cognos\Impromptu\Development Reports\Test Reports\"
Replocn = "\\xserver\Vol2\Data\Cognos\Impromptu\Development Reports\"
PDFLoc = "c:\Acrobats\"
'Start Impromptu and make it visible
Set ImpApp = CreateObject("Impromptu.Application"
ImpApp.Visible True
'Open the named catalog
ImpApp.OpenCatalog Catlocn + "XLive.cat"
'Open the named report
Set ImpRep2 = ImpApp.OpenReport(ListRep+ "Level 2 List.imr", "(1st 1 Level Value)"
'Create the publishing object and send the output to the unique file name
' Set PdfRep = ImpRep2.Publishpdf
' PdfRep.Publish pdflocn + "Level 2 List for " + Dparm + ".pdf"
' Set PdfRep = Nothing
Streamcount = ImpRep2.GetDataValue(2,1)
Scount = 1
Do while Scount <> Streamcount + 1
Sparm = ImpRep2.GetDataValue(3,Scount)
allparm = "5|2003|1|(1st 1 Level Value)|" + SPARM
'msgbox allparm
Set ImpRep3 = ImpApp.OpenReport(pdflocn + "XReport.imr",allparm)
Set PdfRep = ImpRep3.Publishpdf
PdfRep.Publish Pdfloc + "XReport for " + Sparm + ".pdf"
ImpRep3.CloseReport
Set ImpRep3 = Nothing
Scount = Scount + 1
Loop
ImpRep2.CloseReport
Set ImpRep2 = Nothing
Quit the Impromptu application and clear resources
ImpApp.Quit
Set ImpApp = Nothing
Set PdfRep = Nothing
End Sub
(I have copied and pasted the previous code twice more - there are 3 0 level values - A loop would be better?)
If anyone has a better idea for looping all the levels into a filter of a report, it would be much appreciated.
Thanks in advance
End Sub
There are 5 levels in the business, and the prompt asks from 0 to 4 which level they want to choose.The Grouping is also chosen from this prompt,but works one back,so if I choose Level 4, then the Grouping would be level 3.
I need to produce PDFs of every category in every level.(I know -they should have Impromptu Web!)
I understand a series of Level category reports would provide the filter values, and a loop would need to run each level report in turn, moving down to the last,saving to PDF as it went.
I have a macro that goes a part of the way:
Dim ImpApp as Object 'Impromptu
Dim ImpRep1 as Object 'Report1
Dim ImpRep2 as Object 'Report2
Dim ImpRep3 as Object
Dim ImpRep4 as Object
Dim ImpRep5 as Object
Dim PdfRep as Object 'Acrobat publisher
'Variables for the catalog and report locations
Dim Catlocn as String
Dim Replocn as String
Dim PDFLoc as String
'Integers to hold the number of rows in report 1 and a running count for report 2
Dim Rcount as Integer
Dim Runnum as Integer
'Set the locations
Catlocn = "\\xserver\Vol2\Data\Cognos\Impromptu\Catalogues\"
ListRep = "\\xserver\Vol2\Data\Cognos\Impromptu\Development Reports\Test Reports\"
Replocn = "\\xserver\Vol2\Data\Cognos\Impromptu\Development Reports\"
PDFLoc = "c:\Acrobats\"
'Start Impromptu and make it visible
Set ImpApp = CreateObject("Impromptu.Application"
ImpApp.Visible True
'Open the named catalog
ImpApp.OpenCatalog Catlocn + "XLive.cat"
'Open the named report
Set ImpRep2 = ImpApp.OpenReport(ListRep+ "Level 2 List.imr", "(1st 1 Level Value)"
'Create the publishing object and send the output to the unique file name
' Set PdfRep = ImpRep2.Publishpdf
' PdfRep.Publish pdflocn + "Level 2 List for " + Dparm + ".pdf"
' Set PdfRep = Nothing
Streamcount = ImpRep2.GetDataValue(2,1)
Scount = 1
Do while Scount <> Streamcount + 1
Sparm = ImpRep2.GetDataValue(3,Scount)
allparm = "5|2003|1|(1st 1 Level Value)|" + SPARM
'msgbox allparm
Set ImpRep3 = ImpApp.OpenReport(pdflocn + "XReport.imr",allparm)
Set PdfRep = ImpRep3.Publishpdf
PdfRep.Publish Pdfloc + "XReport for " + Sparm + ".pdf"
ImpRep3.CloseReport
Set ImpRep3 = Nothing
Scount = Scount + 1
Loop
ImpRep2.CloseReport
Set ImpRep2 = Nothing
Quit the Impromptu application and clear resources
ImpApp.Quit
Set ImpApp = Nothing
Set PdfRep = Nothing
End Sub
(I have copied and pasted the previous code twice more - there are 3 0 level values - A loop would be better?)
If anyone has a better idea for looping all the levels into a filter of a report, it would be much appreciated.
Thanks in advance
End Sub