Print Page | Close Window

Pass Parameters from main report to Sub report

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2497
Printed Date: 02 May 2024 at 10:35pm


Topic: Pass Parameters from main report to Sub report
Posted By: vijayk
Subject: Pass Parameters from main report to Sub report
Date Posted: 03 Mar 2008 at 7:34am
Can we pass the parameters from main report to sub report.? I don't want the users to answer the same prompts twice since the same prompts exist in both main & sub report.
 
Thanks
Vijay



Replies:
Posted By: BrianBischof
Date Posted: 03 Mar 2008 at 9:50am
I talk about this exact problem on page 362 of my book. You can fix when creating the links between the main report and the subreport. By default, CR creates a parameter field for you to link to (it is shown in the bottom left-hand corner of the Subreport Links window). But you don't want to use this one. Instead, you want to click that drop-down box and pick the exact field to link to. By skipping the suggested parameter field and linking directly to the field in the subreport, you won't be prompted twice.

This is just one of many tips and tricks I have for using subreports in Chapter 9 of my book http://www.amazon.com/exec/obidos/ASIN/0974953601/bischofsystem-20 - Crystal Reports Encyclopedia .

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: vijayk
Date Posted: 03 Mar 2008 at 11:14am
Thanks Brian. ! I will try and let you know
 
Vijay


Posted By: vijayk
Date Posted: 04 Mar 2008 at 12:41pm
It works fine for single values but it is not working fine for multiple values at the prompt. Do we have to do anything special in the command window for inputting multiple values for the prompt.
 
Thanks
Vijay


Posted By: vijayk
Date Posted: 04 Mar 2008 at 12:47pm
ie I am unable to pass multiple values to a parameter created in command object. I use CR XIR2 with ODBC connection to Db2 database


Posted By: BrianBischof
Date Posted: 04 Mar 2008 at 1:31pm
You're trying to pass a multi-value parameter to the stored procedure? You can't do it then. A stored procedure doesn't have a corresponding data type to receive this type of information.

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: brainsoup
Date Posted: 05 Aug 2009 at 4:59am

Follow these steps to pass the parameters from main report to sub report

1. Create a new paramter @mainParam in the main report by right-clicking on 'Parameter Fields' section in Field explorer in the main report.
2. Create a new parameter @subParam in the sub report in the same manner (This wouldn't be required if  you already have the parameter in the sub report)
3. Right click on the sub report in the desing window in your main report.
You will be able to see an option 'Change Subreport Links'.
4. Click on the option and select the @mainParam and transfer it to the sub report using '>' button.
5. Select the appropriate field in the sub report to map to
6. Click ok.
 
Now the field will be appearing only once in the criteria
 


Posted By: tropez67
Date Posted: 07 Aug 2009 at 10:08am

Do you explain anywhere how to pass multiple parameters to a sub-report?

I've got a rather large CR2008 report that when ran we can select one or more programs from the prompt, along with one or more clients. I've linked the sub-report on the client, so it filters correctly there, but can is there anyway to pass the second parameter to filter the sub-report yet again so it only shows programs for that specific client?

If it's in your books, then let me know where because I've missed it.



Posted By: Madhura_J
Date Posted: 24 Mar 2011 at 7:35pm
Hi brainsoup,
 
I tried the points mentioned in this post.Was really useful.Thanks.
But i still have a query in it.
 
I have a main report with the following query
 
select feild1,feild2 from table1 where name='madhura'
 
i have a unlinked subreport which has the query
 
select feild1 from table2 where name-madhura
 
The table1 and table2 are not related to each other and thats y i have created an unliked subreport.
 
But i want the parameter passed for the main report(madhura) to be used in the subreport as well.
Can you please help me..
Thanking you in advance
Madhura.


Posted By: Michael Caine
Date Posted: 16 Jul 2011 at 2:24am
While insert sub report, we can set link between main report and sub report in the link tab.

There we have to select
(i) Field(s) to link to: and

(ii) Subreport parameter field to use:


Optionally we can set

Select data in sub report based on field.


http://www.cegonsoft.com/onjobtraining.php - Cegonsoft OJT


-------------
http://www.cegonsoft-ftp.com/ - Cegonsoft



Print Page | Close Window