SAP Knowledge Base Article - Public

1535329 - How to use date range parameter inside a subreport in crystal reports 2008

Symptom

  • The static date range parameter is linked with subreport, the details are not filtered according to parameter.
  • Inside the subreport, date range parameter appears as a date parameter.
  • Date range parameter linked to subreport as shown in the below image.

''

Environment

  • Crystal Report XI R2
  • Crystal Report 2008

Reproducing the Issue

  1. Create a New Report using Employee table from the Xtreme Sample Database.
  2. Create a Static Date Range Parameter in the Main Report.
  3. Add a Subreport in the Detail Section and link it using this Static Date Range Parameter.
  4. A new parameter is being created inside the Subreport, and when we use the Same Parameter in Subreport in Select Expert it does not output a correct result.

Resolution

  1. Use the Static Date Range Parameter in Main Report, need to separate the Start Date and End Date in two different Formulae
  2. Create a Formula for e.g. date_start
    1. minimum({?Date parameter});    (Note : where {?Date parameter} is the Static Date Range Parameter.)
  3. Create Second Formula for e.g. end_date
    1. maximum({?Date parameter});
  4. Link the Subreport with this Two Formula and two new parameter will be created inside the Subreport.
  5. Inside the Subreport in the Report tab->Selection Formulas->Record write a Formula to filter the Record based on the Date Range
    1. {Employee.date} in {?Pm-@date_start} to {?Pm-@end_date}
  6. You can see the correct result inside Subreport.

Keywords

Date Range, Parameter, Subreport , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports XI ; SAP Crystal Reports XI R2

Attachments

link to subreport.jpg
Detail shown on report.jpg
date-range.jpg