Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Subreported related issue Post Reply Post New Topic
Author Message
vaibhav123
Newbie
Newbie
Avatar

Joined: 03 Nov 2009
Online Status: Offline
Posts: 19
Quote vaibhav123 Replybullet Topic: Subreported related issue
     Posted: 18 Nov 2009 at 9:29am
Hi,

Here is what I am dealing with.

I am trying to use subreports are a way to achieve drill down into the main report. My main report has three fields: Code, Account Number, Date and they are grouped by Code.

My subreport is basically a drill down into the account number field in the main report. That is, my main report will have codes and related accounts while my sub report will have information related to those accounts in the main report. So, the fields in my subreport are : Account Number, Date, (other fields related to account number)

My approach is to place the subreport in the group header of the main report, link it using account number and select the records in the subreport using account number. However, I am running into following problems:

1. Placing the sub-report, only shows the details of the last account in the group on the main report. That is, if under a code, there were 3 accounts, my subreport only has details of the third account and not the first two.
Placing the subreport in Group Header shows the details of the first account number. Is there any way I can get the subreport to show me the details of all the account numbers in a particular group on the main report?

2. I tried linking the two reports based on the code field, however, this one generates a report which is basically identical to the main report with a difference of extra fields. I also tried linking by code and selecting the records based on acccount number, this one however generated a blank report!

Please help and do ask me follow up questions in case the aforementioned is not clear.

Thanks,

-V
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Nov 2009 at 9:37am
Is there a reason you are using sub reports instead of just drilling down in the main report?
 
It sounds like you only want to drill into one account at a time, correct?.
if so in your main report group on CODE then on ACCOUNT, link on ACCOUNT And place the subreport on either then ACCOUNT level GH or GF in the main report.


Edited by DBlank - 18 Nov 2009 at 9:38am
IP IP Logged
vaibhav123
Newbie
Newbie
Avatar

Joined: 03 Nov 2009
Online Status: Offline
Posts: 19
Quote vaibhav123 Replybullet Posted: 18 Nov 2009 at 10:16am
thanks for the prompt reply.

I will try that out. But a follow up question, when I use subreport and place it in report footer (or GH/GF) it only shows me the details related to the last record in the report(or GROUP) and this is when I check the box ("select records in subreports using the field"). Is there a way that through a formula, I can make the subreport to show records related to all the entries on the main report (in a GROUP).

I am using CR2008, can you suggest any good online material or book which can be used by a beginner like me?





-V
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Nov 2009 at 10:51am
Get Brian's Book (link is at the bottom of this page) either in paper or online. It is very goo for basics as well as advanced so you can use it for a long time. I have the paper version as I perfer that to reading on the computer. Also just read as many posts on this site as you can. If possible try and replicate the issue and solution in sandbox reports to erally grasp the process. The more you know about each function the easier it is to use it in a creative way later.
 
Headers and footers (either Report or group) are usually used to display aggregates or common data of all the rows and are not as frenquently used to show row level data. If try to display a row level piece of data on a header it can (and will) only show you the first row from your data set that fall sin the group (or the report in the RH) and the incverse as only the last row of data for Footers.
When you link a subreport to a report it creates a paramter in the subreport and passes a piece of data to the subreport to filter it on. So if you link on the Account# it tries to pass the account number as a parameter. So if you place the Subreport on a GH or GF it will only pass 1 value (the first-Header or the last-Footer) and limit your subreport to that.
 
Does this clear it up?
Using the above info, if you want to open one subreport that shows you all Accounts under one CODE then you link the 2 reports on CODE and place that on the GH or GF in the main report where you grouped CODE.
CODE is shared by all rows in that group and therefore will include all of those records in the subreport...
Making any sense?
IP IP Logged
vaibhav123
Newbie
Newbie
Avatar

Joined: 03 Nov 2009
Online Status: Offline
Posts: 19
Quote vaibhav123 Replybullet Posted: 18 Nov 2009 at 11:27am
Yea, it does make sense. And based on the same reasoning, if I need to see the information related to an account number, I need to link the two reports using account number and place the subreport in its GH or GF. I think I get that part.

But, if I need to see the data related to all the accounts on the main report, I link it using account number and not check the option of selecting the records in subreport based on the account number? And this subreport, I can place in RF? Is that correct?

however, I was wondering if the process of drill down can be achieved in any other way in CR. I know that if you click on a group, you can go within that group. So, does that mean if i need to go down like n levels, I need to have n different groups?

Thanks,
-V
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Nov 2009 at 11:52am
//Before I forget make sure to use the Help Files. They are actually very useful and great for finding items references in in posts that you want to learn about.//
 
If you want to see data for all the accounts don't link it at all.
You can place it anywhere and it will show you all data but you likely want it in the RH or RF because you only want it to run once. If you place it somewhere else it will run for each time that report section appears at runtime.
DrillDown can be (and IMO should be) done without sub-reports whenever possible. IMO you only want to use a sub-report if it is the only way you can get what you need. They are much less efficiant and if you have a lot of them they will kill your report performance. It has to read and retrieve data at least once per subreport display.
In General you can have N level of groups for N drill downs but you do not have to.
You can conditionally suppress sections using DrillDownGroupLevel function so you can, in theory have 8 levels of groups but drill into all at once using the DrillDownGroupLevel=n functionality.
 


Edited by DBlank - 18 Nov 2009 at 12:34pm
IP IP Logged
vaibhav123
Newbie
Newbie
Avatar

Joined: 03 Nov 2009
Online Status: Offline
Posts: 19
Quote vaibhav123 Replybullet Posted: 18 Nov 2009 at 12:28pm
Thanks for all the help!
-V
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