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

Scheduler dependent on an event?

Status
Not open for further replies.

jag14612

Programmer
Feb 18, 2003
9
US
I am new to Impromptu and scheduler. I have 3 reports that are "monthly", but I have no control on the exact date the data will be available for the reports. There is a process that populates oracle tables and the developer/user currently runs the reports manually. I need the scheduler to look for the existance of a trigger file or somthing like that.

The "lame" solution that we came up with is: to delete all rows in the source tables (on the days the monthly process does not run) and have the scheduler run once a day and produce a default page with no data on it. The user would see a "blank" report and know to disregard it. Once a month the reports would be populated. There has got to be a better way.
 
Hi!
Scheduler itself cannot handle the dependencies needed here.
However, you could schedule a macro that would.
What would be the trigger for the reports to run?
If it was a physical file produced, the macro could check for the existence of it and then run the required reports. Alternatively, an initial Impromptu report that could check for the existence of records and then launch the user report if the record count is greater than zero.

Example of method 2:


sub main ()

Dim ImpApp as Object ' Impromptu
Dim ImpRep1 as Object ' Report 1
Dim ImpRep2 as Object ' Report 2
Dim reccount as integer ' record counter

'Start Impromptu and make it visible
Set ImpApp = CreateObject("CognosImpromptu.Application")
ImpApp.Visible True
'Launch the first report. This should be a simple count of records in the first column of the QUERY
Set ImpRep1 = Impapp.OpenReport("c:\test\Myreport.imr")
'Get the value in the first column, first row of the query

On error resume next 'If there are no records, we will get a NULL, so run the test anyway

reccount = ImpRep1.GetDatavalue(1,1)
msgbox str(reccount)
'If value greater than 0, run second report and print it

select case reccount
Case 0
goto endmac
Case Else
Set ImpRep2 = ImpApp.Openreport("c:\test\userreport.imr")
'ImpRep2.Printout '**** UNCOMMENT THIS LINE TO print
ImpRep2.Close

End select

'Label to signify the end of the macro

endmac:

ImpRep1.Close
ImpApp.Quit

'Free up resource
Set ImpRep1 = Nothing
Set ImpRep2 = Nothing
Set ImpApp = Nothing


End sub



 
OK, I figured out how to add and modify a macro and I believe the report I created to count the rows in a table is working. When I run the macro I get the error "test!main(9) - R429 "object creation failed - bad object class"

The following line is highlited:
Set ImpApp = CreateObject("CognosImpromptu.Application")

Thanks for any help you can give!
 
I guess the solution I am looking for, in the long run is some way to run Impromptu from a batch process. My batch process currently ends with table creation. What I would like to do is run impromptu at the end of that job. Now (of course) the batch job is on our UNIX machine and Impromptu runs on our network, so thats a twist there.
My other solution that truncates the tables after a day is really hokey and I very much dislike clearing a table that can be used more than once.
 
Hi
The problem is the version that you are using. Replace the
"CognosImpromptu" (series 7 syntax) with the earlier
"Impromptu" syntax

 
Thanks trev, that got me past the error. I run through the macro now, but I don't get a screen or a report. I have uncommented the printout line. Do I have to define a specific printer and if so how do I do that?
 
Impromptu will print to the default printer associated with the logon. What is the value of reccount being returned?

Regards,

Trev
 
OK I figured it out and the macro was pointing to the wrong report location. Thank you again for your patience.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top