Link to home
Start Free TrialLog in
Avatar of dgandhi05
dgandhi05

asked on

Want to set the date parameter fields to default values

Hi,

 I am using Crystal Reports XI. I am redesigning an existing report which had two date parameters (Start Date and End Date). Now I need to set these to default values. The Start Date should be set to the First Day of the Current Month and the End Date should be set to the Current Date.

 I can't set up default dummy values and then convert it to the dates required, as the parameter fields (Start Date and End Date) are used in the report. So, basically I want to change the values of the parameter fields as they are used in formulas and are not used in selection criteria or expert.

 Let me know!

Thanks,
Dan
Avatar of Mike McCracken
Mike McCracken

You can use CURrENTDATE to get today's date and Date(Year(CurrentDate),Month(CurrentDate),1) to get the first day of the month.

Not sure what you are trying to do.

mlmcc
I believe your problem achieving a dynamic date but not having to "convert" the report to use formulas for start and end date. What I have had clients do in the past is insert the report into the report header of another report as a subreport. The main report acts as a shell and has nothing in it, but what this allows you to do is create formulas in the MAIN report and link them to the parameters of the subreports.

Create your dynamic date formula in the main report and use subreport linking to pass those formulas into your subreport.

Another thing to remember is that if this report is to be scheduled in Enterprise then you should always use DataDate instead of CurrentDate as it stays static when viewed as a report instance (Crystal Reports format only).

This is a workaround solution; ideally you should be using formulas.

Kevin
Avatar of dgandhi05

ASKER

Hi Kevin (Djshorty):

 I tried your solution, but do I have to double click on the report header to display the report. I did put the report as a subreport in another report, and have two date formulas (for start date and end date). I linked the subreport with the two date formulas, but when I click on preview, I just get a blank report. When I double click on the report header (the subreport), I get the report displayed. Is there a way, to display the report automatically and not need to double click on it to run?

 I know, I ideally would want to change the report to include formulas, but it is not a report designed by me, and was asked just to change the start date and end parameters to defaults.

 Kindly let me know!

Thanks much,
Dan
ASKER CERTIFIED SOLUTION
Avatar of djshorty
djshorty

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial