Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Include Two subreports (same report inserted twice) with different parameters for each report

Posted on 2008-11-19
5
Medium Priority
?
596 Views
Last Modified: 2012-05-05
Hi,

I have a crystal report that has a number of subreports,I want to know if I can use the same subreport but pass different parameters twice.  In this case the first subreport is showing everything of a particular status and daterange and the other is showing everything outside this range.  I'm going to create a copy of the inserted sub report and pass the parameters via a dataset but would prefer if possible to not have to create a copy.  I'm using VB.net 2005 to populate the report.
0
Comment
Question by:geraintcollins
  • 3
  • 2
5 Comments
 

Author Comment

by:geraintcollins
ID: 23000672
Oops spoke too soon, not sure how to specify two different sets of criteria on the same table in the dataset.  I guess I need 2 views unless there is another way.
       'Management Action Plan - Sub Report 2
       
        sSQL = "Select * from PlanTable where FPlanID = " & intPlanID
        myDS = GetDataSet(sSQL, "PlanTable")
        rpt.OpenSubreport("ManagementActionPlan-Report1.rpt")
 
        'Management Action Plan - Sub Report 2
 
        sSQL = "Select * from PlanTable where FPlanID = 7"
        myDS = GetDataSet(sSQL, "PlanTable")
        rpt.OpenSubreport("ManagementActionPlan-Report2.rpt")
 
        rpt.SetDataSource(myDS)

Open in new window

0
 
LVL 101

Expert Comment

by:mlmcc
ID: 23001240
Assuming you are linking the main report to the subreports.

Use the date range as part of the link and the selection criteria.

Open each subreport for editting and change the selection criteria so the first one chooses values in the range and the second values NOT in the range.

mlmcc
0
 

Author Comment

by:geraintcollins
ID: 23008628
That's a big help, thanks mimmc.

What if I wanted to pass a parrameter to both of my sub reports from my web form do you know how I'd do that in code?

e.g. I may want to have a field on my form that says status (report 1) status (report2) so that the two sub reports open with different sets of data.
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 500 total points
ID: 23010217
The easiest way is to put the parameter into the main report then use the subreport links to pass the values to the subreports.

mlmcc
0
 

Author Closing Comment

by:geraintcollins
ID: 31518554
Thanks for your help!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month21 days, 1 hour left to enroll

810 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