Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Subreport with parameter from Parent report Post Reply Post New Topic
Page  of 2 Next >>
Author Message
krpmsit
Newbie
Newbie
Avatar

Joined: 06 Feb 2008
Online Status: Offline
Posts: 21
Quote krpmsit Replybullet Topic: Subreport with parameter from Parent report
    Posted: 06 Feb 2008 at 3:06am
Hello,
 
I am working with Crystal XI.
 
I have created 3 indivitual reports with parameter.
Like Start date, End Date and User.
 
Now the requirement is need to be in single report.
 
I decided to put as a subreport.
 
From Parent report i need to select the 3 fields
Start date, End date and user . After selected these three fields, it should directly assign to all the 3 sub reports.
 
For testing purpose, i have added these 3 indivitual reports as a subreport of the Main report. when i run the report its showing 9 input parameter. 3 input parameter from each reports.
 
Is any other way to fix this issue. i want only 3 input parameters and it should assign to all the 3 subreports.
 
Kindly clear me on this topic and Thanks in advance.
 
 
Regards
K. Rajapandian
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 06 Feb 2008 at 3:25am
Hi,
 
You need to link the main report to three Subreports you have created go to the Subreports individually  then right Click  Select Change Subreport Links
 
Select from Available Fields click > to move to Fields to Link select Subreport Parameter  Field to use from left,
 
if you have no parameters created in subreport Crystal Creates the parameter field such as ?PM-table.fieldname......
 
Check Select Data in Subreport based on Field.
 
in ur case for Main report to subreport links  it will be
First       subreport link Start Date
Second  subreport link Second End Date
Third      subreport link Third User
 
Repeat the steps for all three subreports
 
Cheers
Rahul
IP IP Logged
Evil McBad
Newbie
Newbie
Avatar

Joined: 06 Feb 2008
Location: United Kingdom
Online Status: Offline
Posts: 10
Quote Evil McBad Replybullet Posted: 06 Feb 2008 at 6:05am
I have a very similar problem and got as far as linking the reports on the parameter field - however, when I went back into edit the link, it was no longer there.  What am I doing wrong???  Arghhhhhh!!!
Evil
IP IP Logged
krpmsit
Newbie
Newbie
Avatar

Joined: 06 Feb 2008
Online Status: Offline
Posts: 21
Quote krpmsit Replybullet Posted: 08 Feb 2008 at 4:02am
Its wonderful .Its working fine. Thanks Walker.
Regards
K. Rajapandian
IP IP Logged
krpmsit
Newbie
Newbie
Avatar

Joined: 06 Feb 2008
Online Status: Offline
Posts: 21
Quote krpmsit Replybullet Posted: 08 Feb 2008 at 4:11am
Hi,
 
If your problem is not able to link with mainreport and the Sub report means.
1. Connect table and create the parameter field in Main report.
or
1. Write the query in Command and create the parameter field in Main report.
 
2. Right click on subreport -> Change Subreport link-->
Move the subreport parameter from "Available Fields" to "Fields to link to" list box.
 
3. Select the field from "Fields to link to" Listbox and map the field to "Supreport parameter to use"
What are the parameter field, you have created in main report, it will available in the ""Supreport parameter to use" combo box.
 
The above solution is not working then let us know the problem clearly.
 
 
Regards
K. Rajapandian
IP IP Logged
Eany
Newbie
Newbie
Avatar

Joined: 21 Nov 2007
Location: United Kingdom
Online Status: Offline
Posts: 17
Quote Eany Replybullet Posted: 11 Apr 2008 at 7:52am
I have the same problem, but I am using a Stored Procedure in the subreport, with 2 parameters. There is a Kbase article ID c2014605 describing my scenario, but it doesn't work. When I get to the 'Select data' box, and try to link the formulae from the main report, the parameters from the SP in the subreport are not being displayed in the drop down anywhere, and so I cannot perform any linking.
Any ideas anyone ?
Please !
Eany
IP IP Logged
imstillfishing
Newbie
Newbie
Avatar

Joined: 09 May 2008
Location: United States
Online Status: Offline
Posts: 11
Quote imstillfishing Replybullet Posted: 09 May 2008 at 12:29pm
The solution to this is not as obvious as it might seem.  The devil is in the details so they say.
In Crystal X this approach has worked for me.
 
Follow these steps.
1. Right click subreport and select Subreport links
2. In the left pane (available fields) select your input parameter field and click the right arrow to add it to the right side pane (fields to link to)
3. In the bottom right corner, check the options "Select data in subreport based on field"
4. In the drop down, now select "Report Fields" nothing more.
5. Click OK
6. Go to your subreport and select the record or group filter criteria.
7. You may, or may not see a statement something like this...
"{SO_HEADER.DPT_AUTO_KEY} = {?Pm-DEPARTMENT.DPT_AUTO_KEY}"
in that the parameter field filter was already written for you.... but likely not.
8. however, you should now see your main report parameter field displayed in your "Report Fields" list from which you can choose to filter your sub report data on.
9. Manually write your record or group filter criteria using your newly registered parameter field.
 
NOTE: Let's think about this. A parameter field is defined by you, so Crystal doesn't really know what could be "linkable" to your parameter field. Instead, you must NOT select any of your tables or table fields but choose the "Report Fields" instead. This will add it to your sub report "Report Fields" list as a parameter from which you can manually write your filter statements,etc.
IP IP Logged
imstillfishing
Newbie
Newbie
Avatar

Joined: 09 May 2008
Location: United States
Online Status: Offline
Posts: 11
Quote imstillfishing Replybullet Posted: 09 May 2008 at 12:39pm
Forgot a critical step in this explaination - sorry.
You don't actually add the parameter field to your sub report link.
 
First, do the following.
1. in your main report, create a Formula that copies your parameter field.
For example.
Parameter Field called Start Date / it is a Date Field.
Formual Field called strt_date and its value is {?Start Date}
2. Follow the steps outlined above, but select the formula field called @strt_date (or whatever your field is called)
 
Hope this cause too much confusion, and it is helpful.
IP IP Logged
Eany
Newbie
Newbie
Avatar

Joined: 21 Nov 2007
Location: United Kingdom
Online Status: Offline
Posts: 17
Quote Eany Replybullet Posted: 09 May 2008 at 12:58pm
Thanks Imstillfishin. I had great difficulty because I used "currentdate" in the formula in the main report. The link to the subreport didn't work, as the parameters were not presented for linking at the bottom left of the screen. It was only when I changed to use "currentdatetime" that the parameters finally appeared for linking, and then it worked beautifully. Many thanks for your response.
Eany
IP IP Logged
imstillfishing
Newbie
Newbie
Avatar

Joined: 09 May 2008
Location: United States
Online Status: Offline
Posts: 11
Quote imstillfishing Replybullet Posted: 09 May 2008 at 1:11pm
Yup - that will work too :) guess I should have stuck with the obvious.
The parameter type must match the field type to link to.
 
Learned something myself. Well, the above mentioned "trick" is a way
to pass a parameter value to a sub report when the field types don't match and you cannot link them properly.
 
I find that if I use date time values in parameter fields, my users get pretty annoyed because they don't know what time to put in.
IP IP Logged
Page  of 2 Next >>
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.016 seconds.