Solved

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

Posted on 2010-11-14
4
471 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now