views:

1437

answers:

2

Often I'm creating reports in Visual Studio's Crystal Reports and want to have a master-detail or 1-many type thing. Something like this:

Invoice Number 13245
   Total: $1,000,000
   Date Raised: 1-Jan-1989
   Date Due: 1-Jan-2019
Line items:
   #   Desc                  Cost
   1   Hat                  23.00
   2   Gloves                7.00
   3   Walking Stick   999,970.00

I could use a single dataset for something this simple and then group on the 'parent' values, but usually I have multiple types of detail rows or want a graph for the detail records, or for whatever reason I want to have two datasets: one for the parent records and one for the child record.

The way I've always approached this is to base the report on one dataset, add a subreport to the report and use another dataset for the child records. This works fine and looks right - ie when I run the report I see all the data in one view, with the detail section expanded to fit all the records. However, the subreport is always clickable and that is my problem. If a user clicks on the subreport, ie on the child records or a graph or whatever it is I have there, they're taken to the subreport. It's weird to them because they then see a new 'page' which just has the details from that section on it.

What I really want is a way to have my report based off multiple datasets, just like I'm doing now with subreports, but to make it so the user can't click on those subreports and drill into them. I've never worked out how to do this. Is that because I'm just approaching it all wrong, or just a limitation of Crystal Reports, or is there a solution?

I'm using Crystal Reports that comes with Visual Studio 2005.

+1  A: 

Double-clicking a subreport will always open drill-down tab--it's a feature of the product.

Option 1: Embrace the drill-down functionality and use it to enhance your users' experience.

Option 2: Use a single dataset that includes the invoice and line-item details. Group the report on invoice # and place your totals in the Group's Header section. Use the Details section to display the line items. Remember that you can have multiple sections, which may be useful to display your graph (in a second Group Header section).

You may want to consider building the query into the report, rather than doing so in code. This will simplify the report and your code immensely and make it easier to maintain the report and the code.

Craig
For me it's when they single-click, not double-click. Is there a way to change that?I usually have multiple child datasets, so unfortunately option 2 isn't feasible. I don't really understand why there's no way to disable the drill-down; why would you want to drill into something only to see exactly the same information displayed. It's definitely useful to drill in to see more information, but if the report is designed for layout on paper then it doesn't make sense.
Rory
A: 

let's pray for your soul

Joseph