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

Using a main report parameter on a subreport in Crystal Reports Viewer

Posted on 2010-11-14
4
506 Views
Last Modified: 2012-06-27
I'm using C# 4.0 to display a Crystal Reports Viewer report.

The CR report contains a subreport. I need to add a parameter MachineSN to the subreport.

I've added the parameter to the main report but I can't access it in the subreport. On the main report I can right-click on the subreport box and choose Change Subreport Links. If I select MachineSN, it wants to create a filter.

If I manually add a parameter MachineSN to the subreport, I'm prompted for it when the report runs.

So, how can I make MachineSN available on the subreport?
0
Comment
Question by:BlearyEye
  • 2
4 Comments
 
LVL 1

Author Comment

by:BlearyEye
ID: 34130597
I might add that I wan the parameter only to display on the subreport. It does not enter into any filtering of data.
0
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 34130600
If you just want to use the parameter value in expressions or formulas (but not as part of the 'link' ) then you can pass the value using a shared variable.

Declare the variable in the main report header and assign the parameter value to it and then you can pick it up in the subreport by  declaring it in any formula you want to use it.

Shared stringvar myvariable;
myvariable:={?myparam};
""
0
 
LVL 6

Expert Comment

by:nsonbaty
ID: 34130873
do you need to just show the MachineSN, in the subreport as text or your need to extract data related to this MachineSN.
0
 
LVL 1

Author Comment

by:BlearyEye
ID: 34132117
peter57r: that did the trick.

shared variables are tricky ... it took me a while to figure out that they have to appear on the main report somewhere in order to get initialized and show up on the subreport.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

808 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