Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding linked parameter to subreport

Status
Not open for further replies.

richiew13

Technical User
Mar 7, 2006
20
US
I have a report and a subreport. I have one parameter, it is a date range. Instead of a date range I want to have a begin date and an end date for the report parameter. How do I add a linked parameter to a subreport?

The reason I want to change the type is because I want to print the parameter date on the report. (If a user does a query from 5/1/2006 to 5/31/2006 I want it to show up on the report.) If it was entered as a range, I don't know how to print it on the report.
 
Instead of changing the parameter type, you can display the range values by creating a formula:

totext(minimum({?daterange}),"MM/dd/yyyy") + " to " + totext(maximum({?daterange}),"MM/dd/yyyy")

If you want the same date range used in both the main and the subreport, then I would create the date range parameter in each and then link the two parameters to each other in the subreport linking screen, using the dropdown in the lower left to choose {?daterange} instead of the default {?pm-?daterange}.

-LB
 
Thanks, I will try the linking advice.

The problem with your formula is that if I choose the date range of May 1 through May 31, and it turns out there is no data on May 1, my formula label would say "May 2 through May 31". And, although technically accurate, I think this may confuse my customers.
 
No, it wouldn't since the formula is using the parameter, not the database field.

-LB
 
ohhhhh....I see. Never thought of that. I will try both of your ideas. Thanks a bunch!
 
I'm using Crystal 8.5.

When I try using the formula you mentioned, I get a "The summary/running total field could not be created.
 
Where is the subreport linking screen? I am using CR 8.5. I only know about the Add Subreport screen. I already have a subreport, I just want to change the linking.
 
The formula should be created in the formula editor. This formula is for displaying your parameter selection. You would then drag it into the report header or page header.

To link the subreport to the main on the parameter field, you should create the parameter in the subreport also, and in both the subreport and the main report, add the following formula in report->selection formula->record:

{table.date} = {?daterange}

Then go to format->subreport links and move the parameter from the main report field list to the right. Then use the dropdown in the lower left to choose {?daterange}, not the default {?pm-?daterange} that otherwise displays there.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top