COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS Impromptu => Topic started by: JCarter on 20 May 2022 10:20:44 AM

Title: CognosScript - bypass picklist file prompt
Post by: JCarter on 20 May 2022 10:20:44 AM
Hi all, any CognosScript experts out there?

We're trying to help our users migrate off of Impromptu, so we have a script and macro to inventory their IMR files and use runmac32 to save the SQL output.
Everything is working great, except for IMR files that reference a picklist file.

We want absolutely no user interactivity, so trying to get rid of all UI prompts. Any thoughts on how to bypass that prompt or point it to another picklist file that we specify? We don't care about the picklist file itself, just the SQL from the IMR.

CognosScript so far:
Sub Main

   Dim objImpApp As Object
   Dim objImpRep As Object
   Dim strSQLFileName As String
   Dim strImpCatalogName As String
   Dim strImpReportName As String
   Dim ReportPrompt As Variant
   Dim strReportNameArg As String

On Error Resume Next

'Local Username
   user = Environ("username")

'Full Name & Directory for Catalog and Report   
   strImpCatalogName = Environ("ImpromptuInfoCAT")
   strImpReportName = Environ("ImpromptuInfoIMR")

'Supplies Null prompt values for up to 20 prompts
   ReportPrompt = "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|" + "|"

'Opens Impromptu, Enters catalog (no database connection), Opens Report, Enters blank prompts, Exports to SQL, Closes Impromptu
   Set objImpApp = CreateObject("CognosImpromptu.Application")
   objImpApp.OpenCatalog strImpCatalogName,"User",,,,false
   Set objImpRep = objImpApp.OpenReport(strImpReportName, ReportPrompt)
   strSQLFileName = Left$(objImpRep.FullName, Len(objImpRep.FullName) - 4)
   objImpApp.Visible False
   Set objImpRep = objImpApp.ActiveDocument
   objImpRep.RetrieveAll
   objImpRep.ExportSQL strSQLFileName & ".sql"
   objImpRep.CloseReport
   objImpApp.Quit
   Set objImpRep = Nothing
   Set objImpApp = Nothing
   
End Sub


Thanks for anything that might help!