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!

Using a Cognos Script (Cognos EP Se

Status
Not open for further replies.

bustell

Programmer
Mar 22, 2002
159
US
Using a Cognos Script (Cognos EP Series 7), is there a way to retrieve information about the schedule that invoked the script?

The script I am using, is being invoked by a schedule in Cognos Scheduler. I would like the script to be able to retrieve the path and filename that the report has been exported to.

I see where I can search through the schedule collection, but that would reqiure the script to know the name of the schedule that invoked the script.

The goal of my script is be able to be run by multiple scheduled reports and to email the exported file. To do that I need to be able to capture the exported file name from the schedule that invoked the script. I have all the dynamic look ups working on the exported file name and the email portion working. I just need to be able to capture the export file name from the schedule that invoked the script.

Any help would be appreciated. Note, I just started working with Cognos Scripts 2 days ago, so I am far from being an exert.

Thank you in advance,


Pat B
 
Pat,

Do a keyword search here in the Cognos forum. You will find a number of examples of using macros to automatically export reports in various formats, and sending email attachments from these file using MS Outlook and Lotus Notes.

Regards,

Dave Griffin


The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ20-2863 first!
 
Dave,

Not to be rude, but I think you need to re-read my post. I stated that the email and exporting works. The problem that I am having is that I want the script to be able to retrieve the information about the schedule that invoked it.

I am attempting to create a script that will take the name of the export file that was created. Do a lookup in a table based on the file name. From the table, the script retrieves instructions as to who to email the file to, how to rename the file dynamically to include a date, the subject/body of the email.

This will allow me to use the same Cognos script for multiple reports without having to edit the script. I would just create the schedule and add the distribution instructions to the SQL table. The script will handle all the rest.

I have everything working except dynamically retrieving the name of the export file created by schedule that invoked the script so that I can do the database lookup.

All I need help with is how to have the script open the schedules collection, point to the schedule that opened the script and retrieve information about the particular schedule. This is the problem I am having as I plan to have multiple schedules using this same script.

Thank you for any help that you can give.


Pat B
 
Pat,

Not to be rude either, but the examples I indicated would provide alternative examples of how to accomplish your task without the problem of sending a file/pathname to the macro via scheduler.


Perhaps a little more info from you on why you need to provide the name dynamically from scheduler would clear up any confusion.

Regards,

Dave Griffin



The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ20-2863 first!
 
Dave,

I have searched the forum and looked at other posts. All the posts that I have found (not saying that I have found all of them) requires that the file path and name of the file I wish to attach be hard coded in the script.

This requires having a script for each scheduled report.

I am trying to get away from this. I want one script that will retrieve the name of the export file from the schedule that invoked the script. In this manner, I do not need to create a new script for each report.

Obviously, I have had trouble explaining what I am trying to accomplish. I am sorry, that I can't not explain it any better than I all ready have.

I would appreciate any help or suggestions that anyone could provide.

Thank you.



Pat B
 
Pat,

I think I found some info on you problem, assuming I have the problem right [lol]. If you are trying to pass a file/pathname string from Scheduler to a macro for the macro to use, try the following (from a post by sonksen in thread401-50854):

Parameters can be specified for a macro to be scheduled, in the property ScheduleName, if the name is enclosed in double quotes. The macro name must be followed by a space and the string of parameters.

The parameters can then be accessed in the macro using Command$.

It's strange that this is not mentioned in the Cognos documentation !


griffindm (IS/IT--Manageme) Apr 23, 2002
Ron Sonksen,

That's a pretty cryptic way of getting parameters to the macro via Scheduler! Tell me , can you only get the extra prompt string into scheduler by using a macro to insert the scheduled task, or can you get it into Scheduler when you insert the task manually?

Thanks,

Dave Griffin

sonksen (Programmer) Apr 24, 2002
Hello Dave

You also can use parameters for a macro when you insert the task manually.
Just enclose the name of the macro in double quotes.

Regards,
Ronald Sönksen


I hope this helps Pat,

Regards,

Dave Griffin




The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ20-2863 first!
 
Dave,

That is exactly what I started out trying to do, but it wasn't working. Then I got the idea that I could possible use the schedule Object to look up the export file name specified in the task, which I still think would be a better solution.

The problem I was having with passing the command line argument was that I did not enclose the path/name of the macro in quotes.

It appears that, as Ron stated, enclosing the name of the macro in quotes does indeed allow me to specify a command line argument. This will allow me to pass the path/filename of the export file to the macro.

Thanks for your help. Sorry if I wasn't able to better explain myself.

Pat


Pat B
 
Well, I did get this to work, but I am not really happy with the way it works.

In the Scheduler (on the Schedule form, Results tab), I enter the script as "D:\CognosScripts\EMAILREPORTTEST.MCX" "D:\CognosTemp\test1.pdf"

One might this that should work, but to get it to recognize the argument ("D:\CognosTemp\test1.pdf") I have to add a space between the opening quote and the d: so that it reads " D:\CognosTemp\test1.pdf".

I find this very interesting. Does anyone have any thoughts on this?

Thanks.


Pat B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top