Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Pass Parameters from main report to Sub report Post Reply Post New Topic
Author Message
vijayk
Groupie
Groupie


Joined: 14 Mar 2007
Location: United States
Online Status: Offline
Posts: 53
Quote vijayk Replybullet Topic: Pass Parameters from main report to Sub report
    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
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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 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>
IP IP Logged
vijayk
Groupie
Groupie


Joined: 14 Mar 2007
Location: United States
Online Status: Offline
Posts: 53
Quote vijayk Replybullet Posted: 03 Mar 2008 at 11:14am
Thanks Brian. ! I will try and let you know
 
Vijay
IP IP Logged
vijayk
Groupie
Groupie


Joined: 14 Mar 2007
Location: United States
Online Status: Offline
Posts: 53
Quote vijayk Replybullet 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
IP IP Logged
vijayk
Groupie
Groupie


Joined: 14 Mar 2007
Location: United States
Online Status: Offline
Posts: 53
Quote vijayk Replybullet 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
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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>
IP IP Logged
brainsoup
Newbie
Newbie
Avatar

Joined: 30 Jul 2009
Location: India
Online Status: Offline
Posts: 17
Quote brainsoup Replybullet 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
 
IP IP Logged
tropez67
Newbie
Newbie


Joined: 07 Aug 2009
Location: United States
Online Status: Offline
Posts: 1
Quote tropez67 Replybullet 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.

IP IP Logged
Madhura_J
Newbie
Newbie


Joined: 01 Mar 2011
Online Status: Offline
Posts: 4
Quote Madhura_J Replybullet 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.
IP IP Logged
Michael Caine
Newbie
Newbie


Joined: 16 Jul 2011
Online Status: Offline
Posts: 1
Quote Michael Caine Replybullet 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.


Cegonsoft OJT


Edited by Michael Caine - 16 Jul 2011 at 3:06am
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.018 seconds.