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

Setting Date Prompt to a defalt Date

Started by que1983, 22 Apr 2016 08:22:43 AM

Previous topic - Next topic

que1983

In my query1 I have the following filter:  [File Received Date] between ?Begin_Date? and ?End_Date?
I added a prompt as follows: 1st Parameter is Begin_Date and displays Begin Date in the Prompt.  2nd Parameter is End_Date and displays in the prompt also.  Right now the begin_date and end_date prompt defaults to todays date.  How can I get the Begin_date to default to the first day of last month and the 2nd parameter to default to the last day of last month.  Then the user can make their own selection.

I did add this filter however when I use it, I still get todays date default: [File Received Date Default]_first_of_month(_add_months ([File Received Date];-1))

BigChris

I don't think there's a way to dynamically set the default date for a prompt without resorting to javascript (someone please correct me if I'm wrong). I did write something a while back to handle common date selections...it might be useful, or it might not  :)

http://cognostips.weebly.com/blog/date-prompts

chinnucognos

I am not sure that we can achieve thru cognos call, but i assume there may be some html tags needed.
Here is tags:
For Fromdate prompt:
Note: Place below script right beside the date prompt and name the date prompt as "FromDate" in properties and same with the Todate prompt.
HTML1:
<script language="javascript">
//Default is today
var dDate = new Date();
dDate.setDate(1);
pickerControlFromDate.setValue(getFormatDate(dDate, 0 , 'YMD'));
pickerControlFromDate.getValue(getFormatDate(dDate, 0 , 'YMD'));
</script>


For ToDate prompt:
HTML2:
<script language="javascript">
var dDate = new Date();
//Get date 1 month later
dDate.setMonth( dDate.getMonth() + 1);
//Switch to first of next month
dDate.setDate(1);
//Subtract 1 to get last of current month
dDate.setDate(dDate.getDate()-1);
pickerControlToDate.setValue(getFormatDate(dDate, 0 , 'YMD'));
setTimeout("promptButtonFinish();",1500);
</script>


Please let me knw this is working or not
Deal with it!

navissar

If I may offer my presets approach here - it uses Prompt API so you know it will upgrade and it simplifies the date range prompts. Have a go: http://cognospaul.com/2015/05/24/guest-post-a-new-take-on-date-range-prompts/