• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 343
  • Last Modified:

Want to set the date parameter fields to default values


 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!

  • 2
1 Solution
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.

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.

dgandhi05Author Commented:
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,
I forgot to mention that one of the nuances of this solution is that the subreport will not dipslay unless the main report has a field on the report. I would add the Xtreme Sample Database as a data source in the main report, drag a field onto the page header and suppress the section so that it does not display.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now