The Result Data Newsletter   
Volume 701 - January 2007   
© Copyright 2007 Result Data Consulting, Ltd.  614-505-0770  www.resultdata.com   

    Result Data Home Page  |  Newsletter Archive  |  Upcoming Events  |  Classes & Workshops  |  Request Information
 Upcoming Events:  Feb 8: MOBOUG User's Group,  March 7: Microsoft BI Seminar,  April 11: Business Objects Seminar

Return to Newsletter Contents...

 

Introduction to Sub-Reports in Crystal Reports

by: Kristen St. Jean, Crystal Instructor, BI Specialist

 

Subreports can be a powerful tool in Crystal Reports.  Subreports are reports that are displayed inside of a main report.  While there are many advantages to using subreports in a Crystal Report, there are also a few things to consider before using them.

You might ask yourself, why do we use subreports?  One reason to use subreports is that they allow unrelated information to be displayed as one report.  For example, if your company has multiple databases and no common link between tables in one database to tables in a different database, a subreport can be used in bring the data from one database into a report that is based on the unrelated database.  When viewing the report, instead of having to look at two reports for this information, the reports display as one.   This type of subreport is called an unlinked subreport because there is no relationship between the report and the subreport.

Another reason to use a subreport is to create what's called a linked subreport.  Linking a subreport to a report relates the data in some way.  Links can be based on database fields, formulas, or parameters.  One use for linking subreports is to link “unlinkable” data.  For example, a customer table in a database has a customer id field that is a number, while the orders table is in a different database, and it has a customer id field also, but it is a string data type.  In the Links tab of the Database Expert we cannot link these fields because they are different data types.  To relate the information in these two tables we can create an orders report as a subreport and create a formula in the orders report that changes the customer id from a string to a number.  After we create the formula, we can link the subreport to the main report using customer id from the main report to the customer id formula in the subreport.  The subreport should be placed at the level we are linking.  If we have a group on customer in the main report, and we’re linking by customer id, we should place the subreport in the customer group header or footer.  This will display the orders for each customer.

The placement of subreports is very important.  It not only affects the linking, but also determines how many times that subreport is run.  In our example above, the subreport was placed in the customer group in order to display the orders for each customer.  If there are 200 customers in the main report, the subreport will be processed 200 times, once for each customer.  It is important to take this into consideration because the placement of the subreport can greatly affect the processing time of the report.

Another thing to keep in mind when creating a report with subreports is that a subreport cannot contain another subreport.  There can be multiple subreports in a report, but it’s not possible to have any subreports inside of other subreports.   

Remember, subreports can be very helpful in creating reports that couldn’t be created any other way, but they also affect performance, so use them carefully.

Next month we will discuss sharing values from a subreport to the main report.

 

Go to Top  |  Return to Newsletter Contents

The Result Data Newsletter is published approximately once a month to share the latest information on business intelligence data management and CRM. There should be a link below to allow you to change or remove yourself from our list. We take your requests very seriously. If you have any difficulty please contact us at 614-505-0770 and we will make sure that your request is handled properly. This is not intended to be an unsolicited message and you can reach us in person if needed.

© Copyright 2007 Result Data Consulting, Ltd. - All Rights Reserved
All trademarks and copyrights are the property of their respective owners. This information is provided without warranty.
Announcements
New Classes at Result Data
With the new year comes new classes at our award winning training center. New classes for Q1 '07 include:

Xcelsius: Designing Interactive Presentations Certified Class

Microsoft SQL Server Integration Services Workshop

Microsoft SQL Server Analysis Services Workshop

Click on the class name to get information on dates or to register.
Microsoft Business Intelligence Seminar
Join us to learn about the new Business Intelligence technologies on the way from Microsoft. The seminar will be held on March 7th at the Microsoft Polaris office. Please check our web site for the agenda and to register. This free 1/2 day seminar will run from 8:30AM to noon. Click here to register.
Quality Control for Dummies
This book, part of the best-selling "Dummies" series from Wiley, has just been released. Co-authored by Michael Wallace, Principal Consultant at Result Data.
Private Training Classes & Mentoring
Ask us about our private classes and mentoring services and how they can help your team get up the curve fast. 
Next MOBOUG Meeting
The next Mid-Ohio Business Objects User Group (MOBOUG) meeting is February 8th, 2007.  Call 614-505-0770 or click here to reserve your seat
Looking for a Few Good Men and Women
Join our award winning team of Business Intelligence consultants and .Net Software developers.

Send your resume and salary requirements to: jobs@resultdata.com