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

Passing values from a field in the main report to a parameter in a sub

Status
Not open for further replies.

ifthenelsenull

Technical User
Nov 17, 2011
31
US
How can I pass a value from my main report into a parameter in a sub report.

The subreport is a report that I want to run for multiple instances so I created a main that pulls the instances so it can be run without the end user inputting each value.
 
Why can't you run the report (now the sub) with multiple instances in the first place?

Where is the sub located in the main report?

-LB
 
Thanks for the reply:

The sub has a bunch of parameters that usually come from an application and is run on a case by case ad hoc basis by an end user. The original report (now sub) is only set up for a single person.

I wrote a quick main report that pulls all the possible people and then put the sub in. The main report has all the data to send to the sub but when I try to pass the values it creates another parameter beginning with pm- but won't let me change the links to

personname = {?@person} in the sub.

Crystal is making the subreports link personname = pm- @personname which isn't going to be recognized by the SP in the sub.
 
And the answer to my second question?

-LB
 
In the details section but I can put it in a group header. It can go anywhere really.
 
I'm not sure this is possible, but I might be wrong. I'm not very familiar with using stored procedures, but I believe they are processed first, so I don't think a main report, regardless of how it is linked, will be able to force a stored procedure in a subreport to process multiple times.Maybe someone else will jump in.

-LB
 
I think this will work. Each subreport instance will rerun the SP.

You should be able to change the ?PM paramete in the "Change Subreport Links" dropdown to the parameters that already exist. If you can't then the parameter is probably not the same datatype as the field you are trying to pass down. Make sure you know what type of parameters Crystal has created in the subreport (from the SP). This might not be the same as what is in the SP, but what you have to match is how they are defined in the subreport. Then make sure that the field you have in the main report (to pass down) matches exactly to the subreport parameter.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top