If you are unable to create a new account, please email bspsoftware@techdata.com

Author Topic: CognosScript - bypass picklist file prompt  (Read 1498 times)

Offline JCarter

  • Full Member
  • ***
  • Join Date: Mar 2020
  • Posts: 19
  • Forum Citizenship: +0/-0
CognosScript - bypass picklist file prompt
« 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:
Code: [Select]
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!
« Last Edit: 20 May 2022 10:53:47 am by JCarter »