Crystal Reports: 3 New Uses For Sub Reports
page 4 of 5
by Jason Dove
Feedback
Average Rating: 
Views (Total / Last 10 Days): 21673/ 25

Conditional Data Targets

I come across this issue quite often: a report is needed which always shows the same set of data, plus one of two (or more) other sets of data depending on the user's choice or the results returned from the first set of data.

Because a single report can only have one set of linked tables, multiple sub reports must be used. 

For example: a sales report shows revenue for a particular office, if the office has met its target the managers want to see how they compare to the rest of the other offices, but if they fail to meet their target they want to see the sales broken down by each rep to identify any problem areas.

A report based on sales reps and one based on nation office sales require completely different tables.  The most efficient way to solve this problem is to create a sub report for each.  Whichever is not needed is suppressed and given Record Selection criteria which will return an empty report.  The required sub report runs as normal.


View Entire Article

User Comments

Title: RE: But Crystal could do this better   
Name: Ray S.
Date: 2010-11-23 11:39:27 AM
Comment:
To: Bill Geake

I'm sure others will weigh on the capability of passing
parms from Main report to subreports based on SQL commands.
Here's what I do:

1) In the subreport, when you are setting up the command
in the "Modify Command" window, create a parameter,
that has the same type as the calling parameter in the
Main report.

2) From the Main report, right click on the subreport
and select "Change subreport links...". Then link
the Main report's parameter to the subreport's
parameter.

Is this what you had intended to do? If not, sorry for
confusing the issue.

RS
Title: My Thoughts   
Name: PA
Date: 2010-11-23 5:37:51 AM
Comment:
Hi All,

With due regards and respect to the ideas that have been discussed, I failed to understand the "hatred" factor and the "3 New Uses For Sub Reports" concept.

Reasons:
1. Report Header:
This is generally achieved with report templates

2. Reconciling Conflicting Groups:
A single report cannot contain grouping based on multiple logics and combinations , so this is the obvious use of a sub report. I failed to understand, what's new?

3.Conditional Data Targets:
As an alternative, this could be achieved by providing hyperlinks to individual reports by enabling the hyperlink(s) based on condition(s)

Your comments are appreciated.

PA
Title: But Crystal could do this better   
Name: Bill Geake
Date: 2010-11-23 4:38:36 AM
Comment:
If only there could be a way of making it easy to pass values from the main report through to the sub report SQL. Jason hates sub reports; I hate selection formulae, and these hatreds are connected. The performance hit on sub reports isn't just the extra query per sub report instance - it's also the failure to filter data on the server and the increased network traffic that results.

Perhaps it's just my ignorance, but I've never been able to pass parameters to Oracle SQL in sub reports. If SAP could sort this out with an intuitive GUI it would make rich reports so much easier.
Title: Mr   
Name: David WHite
Date: 2010-11-23 3:55:37 AM
Comment:
Amazing! They say the best ideas are really simple. I would never have thought of holding common components in a subreport. What a brilliant idea!
Title: Mrs.   
Name: Preetha Raju
Date: 2010-11-22 9:25:33 PM
Comment:
Really, very useful tips. Specially header concept with the sub report, which I never thought.

Thank you very much, looking forward for more tips from you.

Product Spotlight
Product Spotlight 



Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-29 4:14:08 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search