COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: chandanrock on 02 Apr 2014 10:53:55 AM

Title: Date prompt not passing from parent report to child report
Post by: chandanrock on 02 Apr 2014 10:53:55 AM
I have a scenario where i have a welcome page dashboard report which has only prompts and drill thorugh links to other child reports. I have a requiremment to add 3 static prompts and a from/to date prompt.
The three static prompts are passing to the child report but the date prompt(from and to) do not pass to the child report.
The parameter names in both the reports are same. The filter in the child is "date between Cast(?from? as date) and cast(?to? as date)".
In the source report i have tried passing the parameter value of the two prompts, to the target report and the prompt page in target report still pops up asking fro date values.
I even created a dummy query in source report and created two data items with ?from? and ?to? and tried passing the data item values to the targtet.
But in this case, when i run the report, before the report runs, the two prompts pop up before the the main welcome page dashboard shows up.

Can anyone help me solve the issue.
Title: Re: Date prompt not passing from parent report to child report
Post by: chandanrock on 02 Apr 2014 11:35:52 AM
So guys,
i am able to pass the date parameters to the child report.
The issue was the report was not capturing the dates i selected in the main report and being passed to the child.

The two static prompts i have are set to auto-submit. So when i changed the static prompt selection, the page refreshes and the date is somehow passed.
Now if try changing the date selection, and drill thru, i still see the odl selection. But if i change the static prompts(which refreshed the pageautomatically) the new date i selected is passed.

Is there a way i can refresh the page when i select a new date range?

Thanks
Title: Re: Date prompt not passing from parent report to child report
Post by: Waydin2296 on 02 Apr 2014 09:53:42 PM
Quote from: chandanrock on 02 Apr 2014 11:35:52 AM
So guys,
i am able to pass the date parameters to the child report.
The issue was the report was not capturing the dates i selected in the main report and being passed to the child.

The two static prompts i have are set to auto-submit. So when i changed the static prompt selection, the page refreshes and the date is somehow passed.
Now if try changing the date selection, and drill thru, i still see the odl selection. But if i change the static prompts(which refreshed the pageautomatically) the new date i selected is passed.

Is there a way i can refresh the page when i select a new date range?

I believe if you have auto-submit and the required prompts have been filled, your selections are then processed.
Are the dates required or optional?
Also, would it be ok to use a reprompt button? 
This will not leave the page so you will still want a finish button

Another option is to pass the parameters with a URL
Title: Re: Date prompt not passing from parent report to child report
Post by: navissar on 03 Apr 2014 03:51:43 AM
Hey,
Try this technique, it's solid:
http://cognospaul.com/2014/03/20/passing-parameters-without-refreshing-page/ (http://cognospaul.com/2014/03/20/passing-parameters-without-refreshing-page/)
Title: Re: Date prompt not passing from parent report to child report
Post by: chandanrock on 03 Apr 2014 08:32:43 AM
Thanks for the replies guys.

Waydin2296 - I found a javascript which will refresh the page when i select the date range prompt. This helped me not use a finish button.

Nimrod - I have not used a lot of JS. I see a lot of solutions for reporting are done using JS. I guess i should start learning some Java.

The java script used is placed on top of the page. i dont know why it works only that particular place, but it serves the purpose.

<script language="javascript">
function func() {
if (getFormWarpRequest().elements["cv.id"].value == "RS")
     setTimeout('oCVRS.promptAction(\'finish\')', 100);
else
    setTimeout('oCV_NS_.promptAction(\'finish\')', 100);
}
</script>
<body  onfocus="func()" >
</body>

Thank you both for your time.
Title: Re: Date prompt not passing from parent report to child report
Post by: navissar on 03 Apr 2014 08:35:25 AM
This will work. However, forgive me if I say it's a terrible solution. This will refresh the page whenever you focus on a prompt.
Title: Re: Date prompt not passing from parent report to child report
Post by: chandanrock on 03 Apr 2014 12:05:45 PM
I tried making all the value prompts auto-submit property set to "NO" and tried running the report. The report does not refresh after i select the any other value prompt. The page refreshes only after i select the date prompt. This is causing the date value selected to pass a parameter value selected to the date range prompt in the target report.

Title: Re: Date prompt not passing from parent report to child report
Post by: CognosPaul on 03 Apr 2014 01:14:46 PM
Chandan, the script Nimrod linked to will allow you to pass prompt values without the need to reprompt your page. This is extremely useful in cases with a date prompt, which doesn't refresh the page upon selection, and in pages that are slow to load.

Which version of Cognos are you using? If it's 10.2 or above, the solution provided will work perfectly. Simply copy/paste it into an HTML item, replace the variable containing the report path, and put the input containing the runReport function wherever you want.

Versions below Cognos 10.2 will need some modification to get it to work right. For example there's no easy way to get all the prompt values from all the prompt controls. It is possible however, and I've already implemented it in one of my client sites. If there's demand, I'll adapt that to work on the samples and upload the report xml.
Title: Re: Date prompt not passing from parent report to child report
Post by: chandanrock on 03 Apr 2014 09:16:08 PM
I would love to give this a shot, but i dont have any knowledge on Javascripting.

We are using cognos 10.1 and if you could provide me a script that i can use, it would be really helpful.

Thanks a lot Paul.

Nimrod, you were correct.
I understood what you were trying to tell me when i ran the report and changed windows and came back to the report window and clicked on the screen, the report refreshed again.

Thanks.
Chandan


Title: Re: Date prompt not passing from parent report to child report
Post by: chandanrock on 04 Apr 2014 09:38:59 AM
i tried the script provided, but when the child report opens, the window does not maximize. I do not see the maximize window option.
Title: Re: Date prompt not passing from parent report to child report
Post by: chandanrock on 14 Apr 2014 01:41:10 PM
Hi CognosPaul,

Were you able to get a solution for Cognos 10.1. The script provided works, but the report output window does not maximise/ rezise.

Thanks
Chandan