Hi All,
I have a report with 2 date prompts. Both prompts are optional. While running the report the 2date prompts are automatically set to sysdate. I am unable to remove the default sysdate in date prompt . Can someone help me out. I am using cognos 8.4 version.
I saw some java script in cognoise site but it is not working me.
Could your provide me the steps to achive BLANK date prompt.
Thanks in Advance,
Lee
Give the prompt a name, and add an HTML item directly after it:
<script language="javascript">
document.formWarpRequest.elements["txtDatePromptName"].value='';
</script>
Thanks Paul
Hi
I tried the same code
<script language="javascript">
document.formWarpRequest.elements["txtDatePromptName"].value='';
</script>
but still its showing current date.
Can you please help?
The PromptName should be the name you give to the prompt object on the page. If you don't give it a name, it won't work.
prompt name is "CTSDate"
and expression is
<script language="javascript">
document.formWarpRequest.elements["txtDateCTSDate"].value='';
</script>
is that right?
It should be. What version of Cognos are you running?
8.4.1
Thanks PaulM ,It sort out now.I was using parameter name.
This solution works great except that im noticing when user's are filling out the prompt page after selecting the dates, on the next prompt, if they search the db using '%' the dates disappear. Any ideas why that happens?
The reason that it's happening is that the script runs after the page is refreshed. So the user selects a date, then performs another action on the page which causes the page to be refreshed. The prompt loads, with the previously selected date, then the script is triggered, once again removing the date from the prompt.
The fix is simple. Create a Boolean variable, paramValue('Date') is null, then set that as the render variable on the HTML item.
Paul, could you please possibly be a little more specific? Not quite so simple for me :)
You have an HTML item that contains the JavaScript to remove the value from the date prompt.
In RS, click on that HTML item. On the bottom left pane there is a row for Render Variable. Open that and create a new variable with the expression: ParamDisplayValue('Date') is not null
That's assuming that the parameter name for the Date prompt is Date.
Sorry Paul, so i click on the html item. In the properties I click render variable. In the dropdown I chose 'new boolean variable' and assign it a generic name. The report expression window appears I click the parameters button at the bottom and drag over my parameter and type in is not null afterwards so it reads - ParamDisplayValue('ActCreateStDt') is not null. When I run the report now the current date is now populated which of course is what I want to avoid. Can you please advise?
Try is null instead of is not null, my mistake.
I should have caught that but it works now Paul:) Thank you very much for your help...
Hi Everyone,http://www.cognoise.com/Smileys/default/shocked.gif
I am also trying to default multiple dateprompts with default empty values. However, the javascript empties the prompts on the promptpage but also makes the prompts totally unusable. ??? I have set names for each dateprompt and put that in separate scripts per prompt.
When I do fill in date values (from and to dates), the report ignores these and shows all data.
We are using Cognos 10.1.1
Hope you can help me.
Hi Guys (and girls of course :D )
Figured it out myself. At first I used filters with a between functionality (date >=?prompt1? and date <=?prompt2?) in one filter.
I separated these and made 2 seaprate filters, which did the trick.
kr,