Solved

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

Posted on 2010-11-14
4
519 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
[X]
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
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

623 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