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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best way to pass info to select in a subreport

Status
Not open for further replies.

JellyDude

Programmer
Aug 11, 2003
4
US
I am trying to pass 5 parameters to a subreport from the main report. I need the parameters primarily for the SQL select statement and some formulas in the detail section of the subreport. Finally, the parameters will change each time the Group 1 field value changes in the main report (i.e company branch number).

What is the best way to accomplish this and do I need to be aware of the right "pass"? I will be returning values from the subreport to be used in the main for calculations in each of 5 group footers.

Thanks for your help!!!
 
I'm not sure I understand you. Do you mean 'parameter' in the sense of something entered for the main report, which should not change?

In any case, in Crystal 8.5, values are linked using Subreport Links under Edit. And the value passed will be the value as it is in that section. It can be a formula field, a main-report data field or a main-report parameter. Crystal will want to make its own links, which end up as selection values in the subreport. You can remove these selections from the subreport and use the passed values for something else.

Madawc Williams
East Anglia, Great Britain
 

Madawc,

Thank you for the reply, I will try to better describe the issue(s).

The 5 "parameters" consist of 2 date ranges entered by the user as true Crystal Report parameters and a branch location from a table (Group 1 in the main report) that will change as the location changes (approx 100 branch locations in report).

As each branch location changes, I need to calculate (sum) totals in the subreport based on the new location and the static date ranges. These totals will be used in the Group 1 - Branch location header and in 4 other Group Footers in the main report.

My hope is that each time Crystal "sees" a new Branch Location that it will execute the subreport and return the new totals I need to the main report. I am not sure whether I need to use a linked report, and how to link it correctly, and whether to use parameters provided when linking the report.

Let's try this - does a change in a linked field value "trigger" the subreport to execute and do the PM parameters in subreports communicate that value change to the subreport?

Thank you for your help and thoughts!



 
You need to put the subreport in the group footer, and then pass values like branch and branch location, as I described.

Madawc Williams
East Anglia, Great Britain
 
Why don't you just link the corresponding subreport fields to the parameter fields in the main report (Edit-->Subreport Links)?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top