Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: parameters and subreports Post Reply Post New Topic
Author Message
Gatekeeper
Newbie
Newbie


Joined: 15 Oct 2007
Location: United States
Online Status: Offline
Posts: 10
Quote Gatekeeper Replybullet Topic: parameters and subreports
     Posted: 10 Feb 2010 at 4:18am
I have a main report containing an un-linked subreport(different grouping,sorting,and filtering). It works good. Now, I had to add a user-interface parameter to the main report and incorporated the parameter into a record-selection formula.Works good. This same parameter filter should be applied to the dataset in the subreport too but do I have to do this or is it done already by default via the parameter in the main report?Should I make the un-linked subreport a linked subreport?I do not think there is any discreet common field value to link on between the two reports at the individual record level. Again,the subreport is just a stand-alone set of summarized data (all sections suppressed except report footer). Can I link the subreport to the main report on the user-interface parameter( thus creating a parameter on a parameter)?Perhaps the trick is to link the subreport to the main report on the record-selection formula which contains the (main report) user-interface parameter?I am experimenting.Please help un-confuse me.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 10 Feb 2010 at 7:04am
I am confused.  If there are any parameters in the main report that you want passed to the subreport, that is easy.  If the subreport always returns the same data, then no linking is neccessary.
 
I hope that helps.
IP IP Logged
Gatekeeper
Newbie
Newbie


Joined: 15 Oct 2007
Location: United States
Online Status: Offline
Posts: 10
Quote Gatekeeper Replybullet Posted: 10 Feb 2010 at 7:49am
Yes, there is a parameter (filter) that needs to be passed from the main report to the subreport. How do I do this? I actually just went and added the same parameter manually into the subreport (named it slightly different) so that now two parameter prompts appear on the screen at the same time when the report is opened...one for the main report and the other for the subreport (I put in the prompt text that the report user should make sure to type the same value into both parameter prompts). This is a crude method which I need to improve. So,the next step is to programatically populate the second parameter prompt with the same value from the first parameter somehow so it does not even appear on the screen. Do I accomplish this by changing the subreport from "un-linked" to "linked"?What would I link on?The parameter itself?(the parameter is used in a comparison of it's value as compared to the values in two other fields in a record-selection formula).Or is there another way to programmatically accomplish this?Again, I am hesitant to change the subreport from "un-linked" to "linked" because the subreport is a stand-alone report of it's own so in essence I have created a report within a report with no detail records showing at all.It's all high-level Report Footer summaries only. But I still need to filter the subreport with the same filter used in the main report.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Feb 2010 at 8:20am
Create a formula field from the param in the Main report called 'SR_Link' as
 
Now Link the subreport using the Formula field of {@SR_Link}
In your sub report you will now have a paramter called
{pm-SR_Link}
 
Edit your subreport seel;ct statement using that parameter:
(basically just replace your existing param with the new "pm-param").
IP IP Logged
Gatekeeper
Newbie
Newbie


Joined: 15 Oct 2007
Location: United States
Online Status: Offline
Posts: 10
Quote Gatekeeper Replybullet Posted: 10 Feb 2010 at 11:01am
Worked great! Thanks DBlank!
IP IP Logged
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