Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2010-11-14
4
Medium Priority
?
520 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 2000 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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 …
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

661 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