Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Crystal Report SubReport Parameter Passing

Posted on 2014-04-04
5
12,279 Views
Last Modified: 2014-04-05
Hello Experts,

I am 100% newbie to Crystal, but I have thought my self how to make a simple report with 2 sub reports within it. Forgive my ignorance if my question doesn't make sense :)

In the main report I have a Command. In the 2 sub reports I also have 1 command per sub report (total 3 commands). Temporarily I have wrote in the end of each SQL statement (in the commands) to say where TransNum = 123. I want to replace the 123 with a report parameter. I have been able to do this using 3 separate parameters (ie: trans1, trans2, trans3) and this works BUT I want to be able to specify 1 parameter to be used in the main reports command as well and the 2 sub report commands. I have been Googleing and YouTubing but I cant seem to figure it out. Thoughts?
0
Comment
Question by:triphen
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:Patrick Tallarico
ID: 39979686
You should be able to pass the command parameter value to the sub reports via the 'change subreport links function. Then you can use that value in the select expert of each subreport.
I hope that points you in the right direction.
1
 

Author Comment

by:triphen
ID: 39979912
I don't understand how the "change subreport links" work. What exactly am I doing in there?

Did you mean Database Expert? I cant see how the Select Export would take a parameter...

Thanks!
0
 
LVL 6

Assisted Solution

by:Patrick Tallarico
Patrick Tallarico earned 250 total points
ID: 39979930
When you right click on the subreport from you main report in design view, the 'Change Subreport Links' option should be in the menu.  This is how crystal reports allows for a value from the main report to be passed to the subreport.  As you are creating the link, you should be able to link it to the field in the subreport that you want to match that value to.

http://publib.boulder.ibm.com/infocenter/rsahelp/v7r0m0/index.jsp?topic=/com.businessobjects.integration.eclipse.designer.doc/designer/Subreports9.html

This is a video that explains the links piece of subreports.  The links in the video are accessed through the new subreport wizard, but it is quite similar from the right click menu->Change subreports.  These links should allow you to filter data in the subreport based upon the value for the parameter in the main one.
http://www.youtube.com/watch?v=xxwWFAtGSIM

The explaination is that the links allow you to pass a value from the main report to the subreport.  There is the ability to link a field from the main report to the subreport akin to a SQL join type statement.  Saying that the subreport field X should match the value of the selected value.
I hope this is a bit clearer.  I've had a bit of a long day, and I fear I may not be communicating as clearly as I'd like at this point.
Be well
0
 
LVL 34

Accepted Solution

by:
James0628 earned 250 total points
ID: 39979934
I assume that you've created the parameters in the main report and the subreports.  They should all be the same data type (eg. all 3 are numbers).

 For each subreport, open the "Change Subreport Links" screen.  Select the parameter from your main report and add it to the list on the right.  Then with that parameter selected on the right side, look at the drop-down list in the bottom left.  You should be able to select the subreport parameter there.  That links the main report parameter to the subreport parameter.

 James

 Edit: Ah, stpmt11 beat me to it.  :-)
0
 

Author Closing Comment

by:triphen
ID: 39980684
Thank you both!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question