Want to set the date parameter fields to default values

Posted on 2006-06-02
Last Modified: 2008-02-07

 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!

Question by:dgandhi05
    LVL 100

    Expert Comment

    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.

    LVL 1

    Expert Comment

    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.


    Author Comment

    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,
    LVL 1

    Accepted Solution

    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

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
    Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    This video discusses moving either the default database or any database to a new volume.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now