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

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Re-runing failed jobs/reports

Started by toper, 30 Jul 2012 03:55:37 AM

Previous topic - Next topic

toper

Hello,

I have a number of reports that have its default parameters logic based on $current_timestamp.
When a job (containing many reports) fails, and I cant rerun it the same day, there is a problem.
The job reruns, but the prompts passed to the reports are not correct, as the $current_timestamp changes.

Its time consuming to manually rerun large number of reports.. and involve a human error :(
Would you have any ideas, how to make it work?

toper

It seems most of us have perfect reports that never fail :)
Anyway, really no idea how to rerun properly?

RubenvdLinden

It's not going to be pretty. In order to allow a rerun, you'll need fixed date prompt values.
You can create a prompt page with an invisible date prompt. Use javascript to set the value of the prompt (current date) and then submit the prompt.

I'll try to post an example tomorrow.

tjohnson3050

IBM has something called a Dynamic Report Specification Updater that enables mass changes:

http://www-01.ibm.com/support/docview.wss?uid=swg24021248

You could replace all of your current timestamp logic with something else (like current timestamp minus x days) and re-run the reports.

RubenvdLinden

OK, here's the example I promised:

1. Create a prompt page in your report
2. Create a date prompt control and set the 'Select UI' property to 'Edit box'
3. Set the 'Name' property of the date prompt (in this example, I named it 'MyDate')
4. Set the 'Visible' property of the date prompt to 'No'
5. Remove the default prompt page footer
5. Create a HTML item object AFTER the date prompt:

<script type="text/javascript">
function init()
{
var dDate = new Date();
//Subtract one day for yesterday, remove the next line if you need current date
dDate.setDate(dDate.getDate()-1);

//Replace MyDate in next line with name of date prompt control
pickerControlMyDate.setValue(getFormatDate(dDate, 0 , 'YMD'));

canSubmitPrompt();

// The timeout in the next line is important; the date prompt variable setting might fail without a proper timeout
setTimeout("promptAction('finish');",1000);
}
init();
</script>

6. Replace existing date filters in your report with filters based on the date prompt variable.

If you run this report, you will see a blank page for about a second. After that, the report will run with a fixed date prompt value which allows you to rerun a failed report with the correct date value.

toper

Hello,

thanks for this demo, I like it! I will use it in some of my reports.
I assume that it wont work in non-interactive batch job.. as there is no prompt page involved in the process?
I was hoping that cognos is smart enough to figure out the parameters that were sent to a report and provide the same values when the report is re-run.

RubenvdLinden

If you use a date function like current_date, there's no parameter variable. You just tell Cognos to use the 'active' current date. You'll need prompt variables like in my example. With prompt values, Cognos should be smart enough to retain the 'old' values on a rerun.

Also, my demo works fine in the Cognos scheduler as a non-interactive batch report as long as you don't override the default prompt values on the schedule properties page. The javascript sets the date variable when the report runs on schedule. If the report fails and needs to rerun, Cognos should use the date variable of the failed run.

toper

That's awesome, thanks so much. I need to rewrite my prompts then.

toper

On the second thought - with this approach, users cant pick up their custom date.. as the prompt page will be automatically submitted :(