Hi
I have added below Java script for default date prompt in prompt page.
<script language="javascript">
var dDate = new Date();
dDate.setMonth( dDate.getMonth() - 1);
pickerControlName.setValue(getFormatDate(dDate, 0 , 'YMD'));
</script>
It is working fine and giving me one month back from today's date. But I have a cascading prompt which refreshes the page and all the prompt values are going back . I am working in a Relational database.
How can avoid the prompt values going back ? Please let me know and its urgent.
The JavaScript is triggered by the page load. So every time the report refreshes, due to a cascading prompt for example, the JS will be reset. The solution here is to remove the JS after the page loads. Create a variable based on the date parameter:
paramValue('Date') is null
Use that as a render variable on the HTML item. When the page reloads, Cognos will populate the date param with the contents of the date prompt, the render variable will remove the HTML from the page when it loads.