20,99 €
A report is only useful if those who receive it understand what it means. Knowing how to use Crystal Reports gives you the edge in producing reports from your database that really are crystal clear. Crystal Reports 2008 For Dummies is a quick and easy guide to get you going with the latest version of this bestselling report-writing software. In fact, it's so popular that previous editions have made it a bestseller too. Crystal Reports 2008 For Dummies gives you just what you should know to produce the reports you'll need most often, including how to: * Pull specific information from your database, sort and group it, and find the details you need * Use dynamic or cascading prompts * Troubleshoot and print reports and save time with templates * View reports on your LAN * Write formulas to retrieve specific information * Create and update OLAP reports * Format reports, control page breaks, and even add graphics or Flash files * Enhance your reports with charts and maps * Use Crystal Reports in the enterprise There's also a companion Web site with sample reports from the book and links to sites with more related information. With Crystal Reports 2008 For Dummies by your side, you'll soon be able to create reports from simple to spectacular, whenever the need arises.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 420
by Allen G. Taylor
Crystal Reports® 2008 For Dummies®
Published byWiley Publishing, Inc.111 River St.Hoboken, NJ 07030-5774www.wiley.com
Copyright © 2008 by Wiley Publishing, Inc., Indianapolis, Indiana
Published by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions.
Trademarks: Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and other countries, and may not be used without written permission. Crystal Reports is a registered trademark of Business Objects, SA. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Website is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Website may provide or recommendations it may make. Further, readers should be aware that Internet Websites listed in this work may have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 800-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.
For technical support, please visit www.wiley.com/techsupport.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.
Library of Congress Control Number: 2008927910
ISBN: 978-0-470-29077-4
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
Allen G. Taylor is a 30-year veteran of the computer industry and the author of over 20 books, including SQL All-in-One Desk Reference For Dummies, SQL For Dummies,Access 2003 Power Programming with VBA,Database Development For Dummies, and SQL Weekend Crash Course. He lectures nationally on databases, innovation, and entrepreneurship. He also teaches database development internationally through a leading online education provider and teaches microprocessor architecture locally at Portland State University. You can contact Allen at [email protected].
This book is dedicated to my daughter, Jenny Taylor Warren, who has given me much excellent advice, as well as two outstanding grandsons.
Many people have contributed to the quality and content of this book. I would particularly like to recognize my Acquisitions Editor, Kyle Looper, for his overall management of the project and for keeping me honest, and my Project Editor, Rebecca Senninger, for the day-to-day coordination of the project.
I also appreciate the continued support of my family and the interest of my friends and colleagues. It would not have been possible to complete a project of this magnitude without the support of those close to me.
We’re proud of this book; please send us your comments through our online registration form located at www.dummies.com/register/.
Some of the people who helped bring this book to market include the following:
Acquisitions and Editorial
Project Editor: Rebecca Senninger
Acquisitions Editor: Kyle Looper
Senior Copy Editor: Teresa Artman
Technical Editor: Howard Hammerman
Editorial Manager: Leah Cameron
Editorial Assistant: Amanda Foxworth
Senior Editorial Assistant: Cherie Case
Cartoons: Rich Tennant (www.the5thwave.com)
Composition Services
Project Coordinator: Lynsey Stanford
Layout and Graphics: Reuben W. Davis, Alissa D. Ellet, Melissa K. Jester, Christine Williams
Proofreaders: Susan Moritz, Toni Settle
Indexer: Infodex Indexing Services Inc.
Publishing and Editorial for Technology Dummies
Richard Swadley, Vice President and Executive Group Publisher
Andy Cummings, Vice President and Publisher
Mary Bednarek, Executive Acquisitions Director
Mary C. Corder, Editorial Director
Publishing for Consumer Dummies
Diane Graves Steele, Vice President and Publisher
Joyce Pepple, Acquisitions Director
Composition Services
Gerry Fahey, Vice President of Production Services
Debbie Stailey, Director of Composition Services
Title
Introduction
About This Book
Conventions Used in This Book
What You’re Not to Read
Foolish Assumptions
How This Book Is Organized
Icons Used in This Book
Where to Go from Here
Part I : Reporting Basics
Chapter 1: Transforming Raw Data into Meaningful Information
Major Features of Crystal Reports 2008
The Lone Edition of Crystal Reports 2008
Viewing a Report
Chapter 2: Create a Simple Report Right Now!
First Things First: Finding the Sample Database
Starting Crystal Reports 2008
Creating a Report with the Blank Report Option
Printing a Report
Where to Go from Here
Chapter 3: Report Design Guidelines
Defining an Effective Report Design
Defining Your Audience
Defining the Report’s Purpose
Choosing Content for Your Report
Choosing the Report Appearance
Chapter 4: Starting Your Report
Using the Report Creation Wizard
Starting with a Blank Report
Connecting Your Report to Its Data Source
Part II : Moving Up to Professional-Quality Reports
Chapter 5: Pulling Specific Data from a Database
Get Data Quickly with Select Expert
Using Formulas to Retrieve Data
Using Parameter Fields to Retrieve Data at Runtime
Troubleshooting Tips When Retrieving Data
Chapter 6: Sorting, Grouping, and Totaling Report Data
Sorting Report Data
Adding Sort Controls to a Report
Grouping Related Items
Calculating Percentages
Drilling Down for Detail
Keeping Track of Things with Running Totals
Troubleshooting Sorting, Grouping, and Totaling Problems
Chapter 7: Mastering Report Sections
Changing the Size of a Section
Formatting with the Section Formatting Menu
Using Section Expert for Easy Section Formatting
Placing Groups Where You Want Them
Hiding Details with Summary and Drill-Down Reports
Generating Barcodes
Creating Mailing Labels
Saving Money on Postage with a ZIP Sort
Chapter 8: Enhancing Your Report’s Appearance
Absolute Formatting
Conditional Formatting Using the Format Editor
Creating Emphasis with Highlighting Expert
Adding Pictures to Your Report
Aligning Preprinted Forms
Adding Text from a File
Formatting Options
Special Fields Contain Report Metadata
Raising a Red Flag with Report Alerts
Using Report Templates to Save Time and Effort
Part III : Advanced Report Types and Features
Chapter 9: Displaying Your Top Ten (Or Top N) with Group Sort
Sorting Groups Based on Performance
Going with the Percentages
A Choice of Group Sorts
Troubleshooting Group Sort Problems
Chapter 10: Adding Formulas to Reports
Formula Overview and Syntax
Lessening the Workload with Functions
Creating a Custom Function in Formula Workshop
Changing and Deleting Formulas
Data Types
Variables in Formulas
Control Structures
Chapter 11: Creating Reports within a Report
Combining Unrelated Reports
Linking a Subreport to a Primary Report
On-Demand Subreports Boost Efficiency
Passing Data between Reports
Troubleshooting Subreport Problems
Chapter 12: Combining Report Elements with OLE
Overview of OLE
Static OLE Objects
Embedded OLE Objects
Linked OLE Objects
Embedding or Linking an Object Taken from a File
Integrating Shockwave Flash Objects into Your Reports
Chapter 13: Creating and Updating OLAP Reports
What’s OLAP, and Why Might You Need It?
OLAP Reporting with Crystal Reports
Updating an OLAP Report
Formatting Data in an OLAP Report
Changing Data Appearance in an OLAP Report
Chapter 14: Using Cross-Tab Reports to Mine Your Data
Creating a Cross-Tab Object to Summarize All Report Data
Summarizing the Contents of a Group with a Cross-Tab
Making Calculations within a Cross-Tab Row or Column
Enhancing the Appearance and Readability of a Cross-Tab Object
Chapter 15: Enhancing Reports with Charts
Using Chart Expert
Creating a Chart
Choosing the Best Chart Type for Your Data
Different Chart Layouts for Different Data Types
Seeing How Chart Placement Affects the Data It Represents
Troubleshooting Chart Problems
Chapter 16: Adding Geographic Detail with Maps
Choosing the Right Crystal Reports Map
Creating a Map Step by Step
Troubleshooting Map Problems
Chapter 17: Interactivity Features
Crystal Xcelsius Overview
Adding Xcelsius Capability to a Report
Enhancing a Report with the Tasteful Use of Flash
Part IV : Crystal Reports in the Enterprise
Chapter 18: Crystal Reports Server
Connecting to Data Sources
Formatting Reports with Crystal Reports Developer
Providing Platform Services
Useful Management Tools
Application Services
Web Services
Viewing and Interacting with Reports
Chapter 19: BusinessObjects Enterprise Repository
Adding Folders to Your Repository
Storing Your Valuables in BusinessObjects Enterprise Repository
Using Repository Objects in a Report
Modifying a Repository Object
Deciding Whether to Update Reports Automatically
Deleting Objects from the Repository
Chapter 20: Navigating with Report Parts
Understanding Report Parts Navigation
Using Report Parts to Navigate a Report
Part V : Publishing Your Reports
Chapter 21: Sending Your Reports Out into the World
Printing Your Report
Faxing a Report
Exporting a Report
Troubleshooting Output Problems
Chapter 22: Displaying Reports Online
Exporting to a Static HTML Page
Adding a Hyperlink to a Report
Distributing Reports via crystalreports.com
Integrating with salesforce.com
Publishing to crystalreports.com with Crystal Reports Desktop Publisher
Interactive Report Viewing with Crystal Reports Viewer
Chapter 23: SQL Expression Fields
Creating an SQL Statement
Modifying an SQL Statement
Part VI : The Part of Tens
Chapter 24: Ten Things to Do Before You Create a Report
Identify the Users
Interview the Users
Get Agreement on the Report’s Appearance
Arbitrate Conflicting Demands
Nail Down the Project Scope
Nail Down the Project Schedule
Verify That the Necessary Data Is in the Database
Determine How the Report Will Be Viewed
Determine the Best Report Type for the Users’ Needs
Decide Whether to Include Charts or Maps
Chapter 25: Ten Ways to Give Your Reports More Pizzazz
Use the Correct Fonts
Use Color Tastefully
Enclose Text in Boxes
Emphasize Boxes with Drop Shadows
Produce a Consistent Appearance with Templates
Add an Image
Add a Chart
Add a Map
Combine Two Objects with an Underlay
Separate the Summary from the Details with Drill Down
Crystal Reports 2008 is the latest in a long and celebrated series of report writers for personal computers. Crystal Reports is by far the bestselling report writer package in the world, even though you might not know it by name. (It’s been bundled with many of the most popular applications without being acknowledged by name. For example, a version of Crystal Reports is currently bundled into Microsoft’s Visual Studio .NET.) However, Crystal Reports 2008 is available as a standalone product. And if you want to produce a high-quality report quickly, Crystal Reports is the top choice to do the job.
Crystal Reports 2008 For Dummies is a book that gets you using Crystal Reports quickly and effectively. This book covers all the major capabilities of Crystal Reports but doesn’t bog you down in intricate detail. The objective is to give you the information you need to produce the types of reports that most people need most of the time. I also get into some out-of-the-ordinary report types that you might be called upon to generate on occasion.
Use this book as a handy reference guide. Each chapter deals with an individual feature that you might need at one time or another. Pull out the book, read the chapter, and then do what you need to do. In many cases, step-by-step procedures walk you through commonly needed operations. You might find it worthwhile to put the book beside your computer and perform the operations while you read about them.
Anyone who might be called upon to produce a report based on database data can profit from the information contained in this book. It’s also valuable for managers who might never produce a report but who oversee people who do. This book tells you what’s possible, what you can do easily, and what takes a little more effort to accomplish. This knowledge can help you estimate how long it should take to produce reports of various types.
When an instruction in the book refers to a command path — for instance, “Choose File⇒Save” — that simply means to click your mouse button on File on the main menu, and then choose Save from the submenu that drops down from it.
Anything you see that is printed in a monospaced font is code, or something you’ll run across in the course of programming a database. This is a monospaced font. Crystal Reports executes code that you enter as formulas or SQL statements.
You can certainly choose to read this book from cover to cover, working through the examples, although you don’t have to. Regardless of whether you read it all the way through in order, think of this book as a handy quick reference by your side when you want to perform a particular operation you haven’t used in a while (or ever).
An upcoming section of this introduction explains the icons you’ll normally run across, and there is a good reason for paying attention to each of them. However, consider yourself exempted from the requirement to read anything that appears by a Technical Stuff icon.
Material placed next to one of these icons might be interesting to techies like me (and like some of you out there) but generally isn’t necessary for a full understanding of how to use Crystal Reports.
I’ve never met you, but I have to make a few assumptions about you and what you know. For example, I assume that you know how to use a personal computer and that you’re somewhat familiar with Microsoft Word. If you know how to navigate Microsoft Word, you already know almost all there is to know about navigating Crystal Reports. The user interfaces of the two products are similar.
I assume that you’ve seen directory trees before, such as those extensively used in Microsoft Windows. You know that if you see a plus sign (+) to the left of a node that shows a folder (or other) icon, it means that you can click the plus sign to expand that node to see what the node contains. Crystal Reports treats directory trees in a similar way.
I assume you know how to perform a drag-and-drop operation with your mouse. In Crystal Reports, when you click an object and start dragging it, your progress is shown by a rectangular placement frame. When you release the mouse button to drop the item, the placement frame is replaced by a duplicate of the item that you dragged.
This book contains six major parts. Each part contains several chapters.
Part I introduces you to Crystal Reports and the art of report creation. You find out what a report should accomplish and what it should look like. Then you fire up Crystal Reports and use it to create a simple report based on data held in a database.
You can do many things beyond the basics to make reports more focused, more readable, and easier on the eye. This part gives you the information you need to do all those things.
Part III gets into serious report creation. With the information in this part, you can zero in on exactly the data you want and display it in the most understandable way. You’ll be able to nest one report within another, pull report elements from multiple non-database sources, present multidimensional data in OLAP cubes, illustrate points with charts and maps, and create stunning visuals with Xcelsius and Flash. With these tools, you can produce reports fit for the eyes of the organization’s CEO.
BusinesObjects Enterprise is a companion product to Crystal Reports that controls and secures the distribution of reports. With it, you can make your reports accessible to people on your local area network (LAN), or on the World Wide Web. BusinessObjects Enterprise is also the home of the Repository, which is a great place to store formulas or custom functions so they can be used again.
After you create a report, you’ll want to make it available to the people who need it. Crystal Reports makes it easy for you to distribute your report for viewing, whether to colleagues in your organization or to Internet users around the world. In addition, you can publish your reports using traditional methods. You can print it; export it to a file, or fax it to people far away. After you complete report development, distribution is easy.
Although Crystal Reports does a great job when used all by itself, you can also incorporate it into applications written in a computer language. The Crystal Reports SQL Expression Fields facility gives you direct control over the data in a report’s underlying database. Because a version of Crystal Reports is included as an integral part of the Microsoft .NET application development environment, you can incorporate the power of Crystal Reports into applications you write in Visual Basic, Visual C++, Visual C#, or any language compatible with the .NET framework. This gives the applications you write the sophistication of the world’s leading report writer.
It’s always good to remember short lists of best practices. That’s what The Part of Tens is all about. Listed here are pointers that help you produce outstanding reports with minimum effort, in the shortest possible time.
Tips save you a lot of time and keep you out of trouble.
Pay attention to the information marked by this icon because you might need it.
As I mention earlier, Technical Stuff icons denote detail that I find interesting (and you might, too). However, if you don’t, no big deal. These nuggets aren’t essential to gain an understanding of the topic being discussed. Skip them if you like.
Heeding the advice that this icon points to can save you from major grief. Ignore it at your peril.
Now you’re ready to start finding out about using Crystal Reports 2008 to create professional-quality reports based on data stored in your databases. After all, Crystal Reports 2008 is the latest version of the most-popular report writer in the world. You can use it to quickly whip out simple reports, or you can take a little longer and generate a world-class executive report.
In this part . . .
There’s data in them thar databases, where it’s not doing anyone any good by itself. And your manager wants a coherent report, based on that data, on her desk by the close of business today. What should you do? Panic? Consider joining the Foreign Legion?
You don’t need to do anything that drastic. The chapters in this part tell you how to quickly crank out the report your boss so desperately needs. This part offers you just what you need to know to put the needed information on the boss’ desk before the lights go out tonight. And you’ll start to build your reputation as a person who can deliver the goods when the pressure is on.
Outlining the major features of Crystal Reports 2008
Viewing an existing report
Computers can store and process enormous amounts of data, and with the relentless advance of technology, those capabilities will soon become even more mind-boggling. Even now, the major challenge of getting value from computer systems isn’t to make them more powerful but rather to harness the power they already have and in a way that delivers useful information to people.
Megabytes or gigabytes of raw data are neither meaningful nor useful to people. Instead, you need organized information, distilled and focused on answering specific questions. In businesses and enterprises of all kinds, organizing and presenting information has traditionally been the job of documents called reports. These documents generally comprise multiple pages that can include text, numbers, charts, maps, and illustrations. The best reports convey the facts needed to make the best decisions, unobscured by a clutter of data irrelevant to the task at hand.
Crystal Reports, a leading report-writing application package for more than a decade, is by far the most commonly used report writer in the world. Many people have used Crystal Reports unknowingly for years because it’s often integrated with other applications and not specifically identified by name.
Crystal Reports 2008 includes all the features that made Crystal Reports XI (its predecessor) a worldwide bestseller, plus it offers exciting new features that save you time and effort while you develop your reports. Crystal Reports 2008 is tightly integrated so that all the individual components of the system work together seamlessly to support report creation, modification, and distribution. And the tight integration extends beyond Crystal Reports 2008 to BusinessObjects Enterprise, making the sharing of reports across large enterprises not only feasible but downright convenient.
The Explorers and Experts within Crystal Reports provide highly intuitive visual tools that step you through creating a report. Features such as the Repository (which applies to enterprise installations) and report templates allow users throughout the organization to reuse components or entire reports. There is never any need to reinvent the wheel. If a component in the Repository or a report template comes close to meeting your requirements but doesn’t meet them exactly, you can easily make minor modifications and have a usable report quickly, which is a vast improvement over creating an equivalent component or report from scratch.
The primary job of a report writer, such as Crystal Reports, is to take data from a database and put it into a pleasing, logical, and understandable format for viewing. With Crystal Reports, you are well equipped to give your reports the appearance you want — without having to become a formatting guru.
Crystal Reports offers both absolute and conditional formatting:
Absolute formatting enables you to put text, titles, charts, maps, columns of figures, cross-tabs, and graphics pretty much anywhere you want on the screen. You can handle preprinted forms. You can optimize for screen display or for printing on paper. This is close to the ultimate freedom in report creation — but not quite.
Conditional formatting takes you one step further toward the ultimate: Using it, you can change the format of the data you’re displaying in response to the content of the data itself. With conditional formatting, every time the data in a report changes, a formula that you include in the report can make the appearance of the report change accordingly.
Chapter 8 covers absolute and conditional formatting.
One especially useful feature of Crystal Reports 2008 — carried over from earlier versions — is the Report Alert. Suppose that a value being displayed crosses a critical threshold that requires immediate action on the part of the report’s target audience. When that threshold is crossed, not only is its value displayed, but also a Report Alert dialog box pops up that can’t be ignored.
Another labor-saving feature is Template Expert, which enables you to create and save a report template for later use. Imagine how much time you’ll save if you have to quickly format multiple reports with a common look. Turn to Chapter 8 for more about Template Expert.
Go anywhere today, and you are bound to see barcodes. Barcodes identify every product for sale in just about any store. They identify items of inventory in a company’s warehouse. They identify the furniture in your office. They even identify the cows on dairy farms. The day may not be far off when they identify people. Now you don’t need expensive, special purpose equipment to generate barcodes. Crystal Reports 2008 provides you with that capability, at a fraction of what it would normally cost. Actually, if you already own Crystal Reports, all it costs you is the label stock and the ink it takes to print on it. See Chapter 7 to find out how to include barcodes in your reports.
Did I mention that conditional formatting makes use of formulas to change the format of a report? Well, you can use formulas for far more than that. A formula is like a little computer program that can do computations or other manipulations of data before displaying the result. This makes Crystal Reports more than merely a report writer that puts your data in a nice format. By using formulas, you can make your report select specific records (or groups of records) and display them the way you want, controlling that process by declaring and using variables in your formulas. All the common flow-control structures (If-Then-Else, Select Case, For, While Do, and Do While) are available.
And after you create a useful formula to use later, you can save it as a custom function. Custom functions are added to the standard functions that come with Crystal Reports, keeping them available in one place.
I discuss formulas in Chapter 10.
Crystal Reports has excellent capabilities for the graphical display of data. All the most commonly used chart types are available, so you can display your data in the most meaningful way. If you have geographical data, Crystal Reports can display it in maps that show countries, regions, provinces, or cities. A variety of methods are available to associate values with specific regions, including colors, symbols of various sorts, and even charts.
Chapter 15 shows how you can include a chart in your report; Chapter 16 covers maps.
The Xcelsius design tool is a companion product that integrates tightly with Crystal Reports. You can use it to create What-if scenarios in which a change of input parameters causes an immediate change in visual indicators. You can instantly see the result of a proposed change, before you make it. Turn to Chapter 17 for more information about Xcelsius.
You can also include Flash animation files within a Crystal report, including dynamic charts, graphics, and even video. Data in the report can be displayed in a dynamic manner, using Flash. Crystal Reports 2008 makes it easy to include Flash content in your report. Chapter 17 gives some pointers on adding Flash animations to a Crystal report.
Crystal Reports is designed for distribution in today’s highly connected business environment. You can build reports that are optimized for viewing on computers attached to your organization’s local area network (LAN). You can also put a report on the Web for folks viewing via Web connection and browser.
You can get your report into the hands of its intended recipients in many ways — print and deliver, fax directly from your computer to a fax machine anywhere in the world, or export the report to a file.
If you choose the latter approach, Crystal Reports supports many output file formats, including HTML for viewing over the Web. At least one of these formats is bound to be readable by the people in your audience. The one caveat here is that if you export a report to any format other than the Crystal Reports native format (.rpt), you might lose some of the report’s formatting in the process. You can even export directly to an application, such as Microsoft Word or Lotus Domino. In such a case, Crystal Reports launches the target application and opens your report in it.
As important as the output formats of a report are, the inputs to the report are equally important. Crystal Reports shines in this area, too. It accepts data from a wide variety of data sources, including personal computer databases (such as Microsoft Access) as well as enterprise-wide client/server databases (such as Oracle, IBM DB2, and Microsoft SQL Server). In fact, Crystal Reports can accept data from any ODBC-compliant database or any data source that complies with the Microsoft OLE DB standard. Essentially, if your data exists in a commonly used modern data source, Crystal Reports can use it.
Whereas previous versions of Crystal Reports came in multiple editions, each aimed toward a different audience, Crystal Reports comes in only one edition, which contains the full feature set. Now, you will never be disappointed to find that the edition you bought doesn’t do everything you want. You never need to upgrade as your requirements grow. One product does it all.
The majority of this book tells you how to create a new report from data in a database file, using Crystal Reports. It also tells you how to modify a report so you can create a new report (similar to, but distinct from, the existing one). These are concerns of the report designer. But what if you just want to view a report that has already been designed?
The world has many more people viewing reports than creating reports: maybe even you! No problem. Before I launch into telling you how to create reports in subsequent chapters of this book, I briefly describe the simple process of viewing reports that already exist.
Reading a printed report is obviously the simplest (but also the most limited) way to get the information you want. It doesn’t take a lot of technical sophistication to read text and view charts and maps on a sheet of paper. People were doing so long before computers came along.
For some kinds of information, however, printed reports aren’t as valuable as those you can view online. For example, printed reports aren’t updated when the database from which they were derived is updated. Thus, printed reports might contain obsolete — thus misleading — information. This is a factor you must always bear in mind when basing decisions on printed reports.
As you might expect, you can do more than just create or modify a report with Crystal Reports software: You can also view an existing report. This has some major advantages over reading a printed report, provided that you have Crystal Reports software installed on your computer:
The report is connected to the source database while the report is being viewed. This is an obvious advantage. If the data in the database has changed since the last time you viewed it, you can refresh the report before you view it again by pulling current information from the database. Crystal Reports automatically checks the database to see whether it has been updated since the last time your report was run. If so, it asks whether you want to refresh the report with current data.
You can use the drill-down capability of Crystal Reports to selectively view the detail underlying summary reports. This enables you to get an overview of the subject by viewing the summary, and then drill down into the specific parts that interest you for more detail. (For more on drill-down, see Chapter 6.)
Viewing a “live” report gives you access to the way Crystal Reports uses hyperlinks. You can follow a hyperlink from one part of a report to another part, from one report to another report on the same computer, or from one report to a report on another computer on your network.
You can view reports that include color graphics or color text. For the many people who don’t have high-speed color printers, this provides a way to access the full richness of a report’s contents.
To view an existing report (on a computer with Crystal Reports installed), follow these steps:
1.Launch Crystal Reports from your computer’s Start menu.
Crystal Reports appears, displaying the Start Page, as shown in Figure 1-1. You can choose to start a new report or open an existing report. Several existing reports that have been used recently are listed, or you can go to a larger list of report files if you don’t see the one you want in the list. In addition, use any of the several tabs in the lower part of the screen to access a variety of helpful resources.
2.Select the report that you want to view and then click OK.
If you don’t see the report you want, click Open File and use the Open dialog box to select any report available on the system.
Crystal Reports retrieves and displays the report, as shown in Figure 1-2.
Figure 1-1: The Start Page offers several options.
Figure 1-2: Viewing a report is a snap.
3.Move through the report.
Scroll around the report, and move back and forth among its pages. You can drill down into any summary report that supports drill down. If the report contains hyperlinks, you can follow them to other locations in the report or in other reports.
4.When you’re finished viewing the report, choose File⇒Close to close it.
You can use Crystal Reports Server (a separate product) to display your reports to 20 simultaneous users on a LAN, or use BusinessObjects Enterprise to distribute the report to thousands of enterprise users or millions of users on the World Wide Web. Users on a LAN that’s directly connected to Crystal Reports Server can use the free Crystal Reports Viewer to access the reports they need.
Users on the Web can view reports with a standard Web browser, such as Internet Explorer or Firefox.
Starting Crystal Reports
Creating your first report
Printing your report
Troubleshooting your report
When you start Crystal Reports, you generally want to do one of three things:
Create a report.
Modify a report.
Run a report against the data in your database.
You use reports to take data from a database and then process, format, and finally output that data to a printer, computer screen, or Web site.
You probably chose Crystal Reports because you have a database that contains information that’s important to you. In all likelihood, the data in that database changes with time, and you want to be able to keep up with its current status. Sure, you could retrieve the information you want by making SQL queries, but that would be too much like work. It’s far better to create a report with Crystal Reports, and then run the report whenever you want the latest status of the information of interest. You need to create the report only once, and then you can run it many times, getting the latest results with each successive run. You don’t have to learn SQL or any other method of pulling data from a database. Reports created with Crystal Reports are easy to build, easy to read, and easy to understand. What could be better?
Crystal Reports gives you tremendous freedom in how you can lay out your report. It also gives you great latitude in what you include in the report. In addition to text and columns of numbers, you can include graphical images, charts, graphs, and maps. You could even crank out a full-length science fiction novel with Crystal Reports if you wanted to (although other tools are better suited to that task).
In this chapter, I walk you through building your first report from scratch, using the Crystal Reports sample data as its basis. The sample’s tables are filled with data that you can manipulate and display with Crystal Reports. You can use this sample data as the basis for your first report. And if you’re not exactly sure what you need to choose from the sample database in this first-run report, don’t worry: I take you through all your choices, including which tables and what data items to use, how to manipulate the data, formatting the report, and ways to output the report.
Crystal Reports has a sample database you can use for practice. It’s a Microsoft Access database for a fictitious bike shop, named Xtreme Mountain Bikes, Inc. If you don’t have a copy of xtreme.mdb on your computer, you can download a copy (a Zip file) from the Business Objects Web site at
http://support.businessobjects.com/downloads/samples.asp
Unless you recently downloaded the sample database, you probably have an older version of xtreme.mdb. This older version works fine. With the 2008 release, Business Objects made a serious attempt to reduce the “installation footprint” of the product. To do that, Business Objects left out a number of files that had been included in earlier versions. Many of these (including xtreme.mdb) are available for download from the Business Objects Web address.
The xtreme.mdb database contains a number of database tables that are representative of the tables that a real-world bike wholesaler might maintain. As I mention earlier, these tables are filled with sample data that you can manipulate and display with Crystal Reports.
The first step when creating a report is to launch Crystal Reports from the Windows Start menu. When you do, the Crystal Reports Start Page appears, shown in Figure 2-1.
You can choose from among five different ways to start a new report. You can create a Crystal Reports document by using one of several wizards or by starting with a blank report. Alternatively (as I demonstrate in Chapter 1), you can open a report that already exists, either to change it or to run it.
Although using the wizard can be a time- and labor-saver, it does constrain the form of a report. The special-purpose report wizards, such as the Cross-tab Report Wizard, are great for creating certain specialized reports. This chapter takes you right to the point and shows you how to create a report your way, starting from a blank report instead of using a report wizard.
Figure 2-1: Welcome to Crystal Reports!
If you’re using Crystal Reports to report on the contents of a database, you need to know what a database is. In the loosest sense, a database can be any collection of data items organized in any way. Crystal Reports can deal with data in several formats, but primarily it deals with the data in relational databases. Relational databases contain data in one or more tables that are organized like spreadsheets, with rows and columns. Each table contains data items that are related to each other. One table might contain data on a company’s customers. Another might contain data on the company’s products. Each column in a table deals with a specific attribute, such as a customer’s last name or a product’s unit price. Rows in a table would contain the information on a specific data element, such as Ms. Jones in the customer table or bicycle in the product table. The columns in a table are sometimes called attributes or fields. The rows in a table are sometimes called records. Don’t be confused if you see these terminologies intermixed. They are often used interchangeably by database practitioners.
As I allude in the introduction of this chapter, here’s what you need to decide upfront when creating a report:
Which tables in the database contain the data you want
Which data items you want from those tables
What manipulations of the data to perform to give you the information you want
How you want your report to be formatted
Whether the users of your report will retrieve it from a black-and-white printer, color printer, local computer screen, or Web site
For now, imagine you already know all those things.
To create a report from scratch, follow these steps:
1.Start Crystal Reports.
The Crystal Reports Start Page appears; refer to Figure 2-1.
2.Select the Blank Report option.
The Database Expert dialog box appears, as shown in Figure 2-2, which shows you possible places to find the source of your data.
Figure 2-2: The Database Expert dialog box shows where to find your source data.
3.In the Available Data Sources pane, click the plus sign to the left of the Create New Connection folder to expand it.
This is the folder you choose when you create a report from scratch. Once you have connected to a database, Crystal Reports remembers where it is from then on.
4.Double-click the database type that matches your data source.
Crystal Reports recognizes a variety of different database types.
You must select the right type. If you don’t know which type is correct, ask someone familiar with the data source.
To follow along with this example, double-click Access/Excel (DAO). The Access/Excel (DAO) dialog box appears, as shown in Figure 2-3.
Figure 2-3: The Access/Excel DAO dialog box asks how to connect to your data source.
5.Click the ellipsis (...) button to the right of the Database Name field.
The Open dialog box appears. If you are lucky, it displays the folder that contains the xtreme.mdb database file. The sample database — xtreme.mdb — is located wherever you placed it after you downloaded it. You might have to browse to find this file on your system.
6.Locate the xtreme.mdb on your computer and click the Open button to open the database file and dismiss the Open dialog box. Then, back in the Access/Excel (DAO) dialog box, click Finish.
Database Expert reappears, as shown in Figure 2-4, with the xtreme.mdb database connected. You can tell the connection is successful if you see Add Command, Tables, Views, and Stored Procedures listed below the connection in the Available Data Sources pane.
Figure 2-4: The xtreme.mdb database is connected to the report.
7.Expand the Tables node, and then double-click the table on which you want to base your report.
To follow along with the example, double-click Product.
The reference is moved to the Product table from the Available Data Sources pane to the Selected Tables pane as shown in Figure 2-5.
Figure 2-5: The Product table has been selected.
8.Click OK to close Database Expert.
A blank report fills the window, as shown in Figure 2-6.
Figure 2-6: A blank report.
The Design tab (on the left edge) shows five sections of the report:
Report Header: Appears only at the top of the report; the first thing that a viewer sees
Page Header: Appears below the report header and at the top of all other pages in the report
Details: The actual content of the report
Report Footer: Appears after the last detailed information in the report
Page Footer: Appears at the bottom of every page of the report
The toolbars at the top of the window give you immediate access to the major features of Crystal Reports. You are probably already pretty familiar with the first two toolbars, the Standard toolbar and the Formatting toolbar. They are similar to the corresponding toolbars on any Windows application, with a few additional items are specific to Crystal Reports. If you hover your cursor over any of these, a tooltip appears, telling you what each one is.
The third toolbar actually combines three separate toolbars: the Insert Tools toolbar, the Expert Tools toolbar, and the Navigation Tools toolbar. Figure 2-7 shows these toolbars.
Figure 2-7: The Insert Tools (top), Expert Tools (middle), and Navigation Tools (bottom) toolbars.
Depending on the resolution of your computer screen, the Crystal Reports window might not display the full width of your report. You can give yourself a little more width in your display by changing one of the display options. Follow these simple steps:
1.Choose File⇒Options.
The Layout tab of the Options dialog box appears, as shown in Figure 2-8. Think of this as Control Center for the appearance of your report.
2.In the Design View section, select the Short Section Names check box.
This reduces the section names on the left edge of the window to one- or two-letter abbreviations, freeing up a little horizontal real estate.
3.Click OK.
4.Drag the left edge of Field Explorer farther to the right.
You won’t need Field Explorer right away. It’s your primary tool for placing data into your report.
This allocates more horizontal space to the work area, which allows you to view more of the report without resorting to horizontal scrolling.
Figure 2-8: Control the appearance of your report here.
The Report Header area (at the top of the first page of the report) is the ideal place to tell the reader exactly what the report contains. However, this forces you, right here at the beginning, to decide what the report is to contain. No problem: Start by considering who your target audience is and what they want to know. (You can read more about making these decisions in Chapter 3.)
If you are Xtreme Mountain Bikes — and for this example, you are — the target audience for your Products report is potential customers. They surely will want to know what products you carry, including information on color and size, where appropriate. They probably want price information. They’ll also need to know the stock number of an item so they can specify it properly when they decide to purchase a bike.
Placing your company logo in the report header also makes sense. Unfortunately, the Xtreme logo isn’t available conveniently on the Crystal Reports distribution CD or on the Business Objects Web site. For the purposes of this demonstration, any logo-sized image file in one of the popular image file formats such as JPEG or GIF will do. BMP files are not supported, however. You can add one to the report header along with a title, such as Product Price List.
To add a logo to a report, do the following:
1.Dismiss Field Explorer, if necessary, by clicking the X in its upper-right corner.
2.With the Design tab selected, click the Insert Picture icon on the Insert Tools toolbar.
You can find out the name of a toolbar icon (such as Insert Picture icon) by hovering your cursor over it. After a few seconds, a tooltip appears, telling you the name of the tool.
A dialog box appears, displaying the image files in the Databases folder. I had no image files in my database folder, so I looked around until I found a sample report with the logo on it. I copied it, saved it to JPEG format, and then inserted it into my report. Perhaps you’ll find a suitable image. Anything that is approximately the right size and shape is fine. Your organization’s own logo would do, as would a drawing your child made.
3.Click the picture’s filename to select it, and then click the Open button. An outline of the logo appears on the report layout. Place it in the upper-left corner of the report header with the mouse, and then click to fix it in place.
Figure 2-9 shows the result.
Figure 2-9: Your report has a company logo.
Next, put a report title into the Report Header section. To do this, you use several tools from the Insert toolbar.
1.Pull down the dividing line between the Report Header section and the Page Header section so that you can place the report title below the level of the logo.
To pull down a dividing line, hover the cursor over it until the cursor changes shape, click and hold the left mouse button, drag the line to where you want it, and then release the mouse.
2.Click the Insert Text Object icon on the Insert Tools toolbar.
The cursor changes to a plus sign (+).
3.Move the cursor into the Report Header section, just below the logo. Click the mouse button to establish the upper-left corner of the text box and then drag across the page and release the button at the lower right of the Report Header section.
A text cursor starts to blink inside the rectangle you created.
4.At the blinking cursor’s location, type the report title.
For the example, type Product Price List.
5.Select the title you just typed, and then increase its size by clicking the Increase Font Size icon on the Formatting toolbar.
6.Make the title bold by clicking the Bold icon on the Formatting toolbar.
7.Click the Align Center icon to locate the title in the center of the page.
Your report should look similar to Figure 2-10.
Figure 2-10: The report title is now in the Report Header section.
The next logical step is to place in the Details section the fields you want the report to display. Simply follow these steps:
1.In Field Explorer, click the plus sign to the left of Database Fields; click the plus sign to the left of Product to display its fields.
Because the Product table is the only available data source, it’s the only one listed.
If Field Explorer isn’t visible, choose View⇒Field Explorer from the main menu.
Field Explorer displays the fields in the Product table, as shown in Figure 2-11.
Figure 2-11: The contents of the Product table.
2.Click the first field that you want to include in the report, and then drag it to the left edge of the Details section.