it is a while ago since i wrote a Cognos script for impromptu…
i looked through my archives and found the code below. I thought it was used for creating or changing catalogs with a macro… ???
'force all variables to be declared
Option Explicit
'declare a function which determines the filename without the extension
Declare Sub GenerateTableFolder(intTableCounter As Integer)
'declare the variables
Dim objImpApp As Object
Dim objImpCat As Object
Dim objDatabase As Object
Dim objCatFolders As Object
Dim intFolderCounter As Integer
Dim intFolderCount As Integer
Dim intTableCounter As Integer
Dim intTableCount As Integer
Sub Main()
Set objImpApp = CreateObject(“Impromptu.Application”)
'there has to be an active catalog
If objImpApp.CatalogOpened = 0 Then
MsgBox “Please open a catalog first!”, 0, "No Catalog Opened"
Exit Sub
Else
Set objImpCat = objImpApp.ActiveCatalog
Set objDatabase = objImpCat.Databases(1)
intTableCount = objDatabase.Tables.Count
If intTableCount = 0 Then
’If there are no tables in the catalog, there is no need
’to create a folder of the tables
MsgBox “No tables in the catalog!”, 0, "No tables"
Exit Sub
Else
Set objCatFolders = objImpCat.Folders
’Make the folder “Original Tables”. If this folder already exists
’there will be an error. A check routine can be build but is
’omitted in this macro.
objCatFolders.AddFolder(“Original Tables”)
For intTableCounter = 1 To intTableCount
’For each available table there will be a folder created in
’the procedure "GenerateTableFolder"
GenerateTableFolder(intTableCounter)
Next intTableCounter
End If
End If