views:

21

answers:

1

I have a report that prompts the user for a start date and end date using parameters. The parameters have a Date type and the List of Values is Static. However, because the parameter types are Date, I'm not supplying a list of values. The user simply selects the date from the date dialog popup, or enters a date.

I would like to provide a default value for each parameter (the current date). However, since I don't have a list of possible date values, I cannot put anything in for the Default Value. Is there any way around this?

Thanks.

+2  A: 

One solution is to not use the date that is passed into the parameters directly, but instead use a formula that does the processing to return a date. So, for example, you can change the data type of your parameter to a String and make one of the options for your StartDate parameter "Today". Then, in your formula you can just do this:

if {?StartDate}="Today" then CurrentDate

Most of the reports I write are set up to accept relative dates like "w-1", which is the date one week ago or "t-2" which is two days ago and so on. You could also check to see if the user entered a date in the form "mmddyyyy" or "mm-dd-yyyy", etc. and do the appropriate processing that way. The down side is that you lose the calendar pop-up in CR to do the date selection.

Ryan