Print Page | Close Window

how to pass date range to sub report

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9894
Printed Date: 01 May 2024 at 5:26pm


Topic: how to pass date range to sub report
Posted By: flanman
Subject: how to pass date range to sub report
Date Posted: 04 May 2010 at 4:54am
I have a main report and sub report that are linked by an account ID field. I am brining in a shared value from the sub report into the main report that is used in some formulas. That is all working fine. I also have the main report setup to allow the user to enter a date range.  How can I pass on the date range from the main report to the sub report so both report give me the correct date range?

I am Using CRXI if that helps
Thanks,

Bill



Replies:
Posted By: DBlank
Date Posted: 04 May 2010 at 5:15am
are you using one param with a min and Max value or are you using 2 params (start date and end date)?


Posted By: flanman
Date Posted: 04 May 2010 at 5:27am
I am using two parameters (StartDate and EndDate).


Posted By: DBlank
Date Posted: 04 May 2010 at 5:34am

Create two formula fields in the main report to be used for passing the params to any sub report. One for StartDate2 and one for EndDate2

@StartDate2 will be
{?StartDate}
 
 
@EndDate2 will be
{?EndDate}
 
Now right click on the sub report and select Change Sub Report Links
Select @StartDate2 and move it into Fields to link on
Select @EndDate2 and move it into Fields to link on
Select OK
Go into the sub report.
You should now see 2 new params
mailto:Pm-@StartDate2 - Pm-@StartDate2
mailto:Pm-@EndDate2 - Pm-@EndDate2
Go into the select expert and use them to limit your data
Table.Field in mailto:%7b?Pm-@StartDate2 - {?Pm-@StartDate2 } to mailto:%7b?Pm-@EndDate2 - {?Pm-@EndDate2 }


Posted By: flanman
Date Posted: 04 May 2010 at 6:24am
As usual it worked like a charm. Once again. Thank you.


Posted By: Hummels
Date Posted: 12 Jun 2014 at 12:19pm
I'm running Crystal Reports 7. I ended up doing just this with a Date Range parameter I needed to send to a Sub Report. But, I also have a Multiple Value Parameter for choosing Users to run a report on. So there could be 1 Username, 5 Usernames or X Usernames. The best I can do is to get it to recognize the FIRST Username that is put in. Works fine in the Main report, If I run the Sub Report, it also works. Just not when the Main Report links the parameter to the Sub Report. Is this not possible in CR7?



Print Page | Close Window