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

CognosScript Functions

Status
Not open for further replies.

cheese8000

Programmer
May 29, 2007
2
CA
Hello,

I'm having problems with a function call and unsure if the problem is my lack of understanding or something else that is causing it to not work.

Here is my code:

Code:
Option Explicit

GLOBAL CONST CATALOG= "C:\Impromptu\Catalogs\catalog.cat"
GLOBAL CONST USER = "xxx"
GLOBAL CONST PASS= "xxx"
GLOBAL CONST CLASS= "xxx"

GLOBAL objImpApp    as Object

Declare Function getImpApp() as Object
Declare Sub      setImpApp(impr as Object)


Sub Main
   On Error goto ErrorHandler
   
   Call setImpApp(CreateObject("CognosImpromptu.Application"))   

   ' objImpApp.OpenCatalog CATALOG, CLASS, , USER , PASS
   getImpApp().OpenCatalog CATALOG, CLASS, , USER , PASS


   Dim fileName as String
   fileName = "C:\Impromptu\Daily Sales.txt"


   Exit Sub
   
ErrorHandler:
   Exit Sub  
End Sub



Function getImpApp()
   On Error goto ErrorHandler
   getImpApp = objImpApp
   Exit Function   
ErrorHandler:
   Exit Function  
End Function


Sub setImpApp(impr as Object)
   On Error goto ErrorHandler
   Set objImpApp = impr   
   Exit Sub  
ErrorHandler:
   Exit Sub  
End Sub


The problem is these two lines:
Code:
   ' objImpApp.OpenCatalog CATALOG, CLASS, , USER , PASS
   getImpApp().OpenCatalog CATALOG, CLASS, , USER , PASS

If I use the first line (currently commented out) this code works fine. If I use the second line that makes use of getImpApp() then the code fails and I can not determine why the difference between the 2 lines.

I am using Impromptu 7.1.9

Any help would be appreciated, thanks.
 
Could you tell me what is the text of the error?

Maybe I could help you with it because I use a script who look like yours and I don't have any error. But i'm on older version (Imrpomptu 7.0)

Loys
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top