cheese8000
Programmer
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:
The problem is these two lines:
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.
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.