- Shopping Bag ( 0 items )
Who is this book for?...
Ships from: Garland, TX
Usually ships in 1-2 business days
Ships from: Garland, TX
Usually ships in 1-2 business days
Who is this book for?
This book is for programmers who want a comprehensive guide to the functionality included with Crystal Reports for Visual Studio .NET. This book is mainly aimed at readers who have some experience with Crystal Reports. However, the book will also prove valuable to readers who are new to Crystal Reports, and want a guide to this reporting tool that is included within Visual Studio .NET.
This book will teach you how to:
Crystal Reports has enjoyed a long association with Microsoft and has shipped with Visual Basic (and subsequently Visual Studio) as the default report writer since 1993. Developers have traditionally had a love-hate relationship with Crystal Reports - they loved the functionality it provided and the free runtime license, but hated having to upgrade to the latest version to get the features they required, and the fact that reports could not be created or modified programmatically, but only through the UI (either the developer UI with Visual Studio or with the consumer UI with the Crystal Reports retail package).
Just as the release of Visual Studio .NET represents a significant leap for the Microsoft development platform, the release of Crystal Reports for Visual Studio .NET is also a milestone for the Crystal Decisions development team. Following the Microsoft .NET strategy, the product has been redeveloped to take advantage of the .NET Framework and is now a fully featured product in it's own right - developers no longer have to wait to upgrade to the latest release to get the features they need.
In this chapter, we are going to take a first look at Crystal Reports for Visual Studio .NET (Crystal Reports.NET), including how the product is different from other versions of Crystal Reports, how to find and run the sample applications that are included, and where to find the tutorials that will get you up to speed with the product. We will also take a look at the new Crystal Reports.NET architecture, and learn how it fits into the .NET Framework.
Whether you are an experienced application developer looking to move to Visual Studio .NET or you are developing your first application and have never heard of Crystal Reports, it all starts here.
What is Crystal Reports?
In simplest terms, Crystal Reports is a report design tool that allows you to create reports that can retrieve and format a result set from a database or other data source. In addition to simply reading data from a data source, Crystal Reports has its own formula language for creating calculations and a number of features that can be used to turn raw data into presentation-quality reports, with graphs, charts, running totals, and so on.
If we were to look at all of the different types of reports that could be created using Crystal Reports, you would find that they are as varied as the developer or end user who created them.
You can create reports that range from a simple list with only a few columns to a complex management report that shows multiple graphs, tables, and Key Performance Indicators (KPIs). The flexibility of the report designer itself means that it can be used for many different types of reports and output, depending on your needs.
In addition to a powerful toolset for actually creating reports, Crystal Reports also features a number of APIs and tools specifically created for developers to allow them to integrate these reports into their own applications. To help understand these features and how they are used, we are going to have a brief look at the history of the products leading up to this release of Crystal Reports.NET
A Brief History
In the beginning, a small company in Vancouver called Crystal Services developed a DOS-based reporting add-on for ACCPAC accounting in 1988. A few years later, in 1992, the company released Crystal Reports, touting it as the "world's first Windows report writer" and it wasn't too long after that Microsoft standardized on Crystal Reports as the reporting engine for Visual Basic and the rest is history.
Within a year of that historic partnership between Crystal Services and Microsoft, over a million licenses of Crystal Reports were shipped, giving it a foothold within the developer community and ensuring long-term success. Since that time, Crystal Reports has evolved alongside the available platforms and development tools, moving from floppy distribution to CDs, from 16 to 32-bit, and from a .DLL print engine to ActiveX control to Automation Engine to .NET Classes.
Over the years, the user interface for creating reports hasn't changed much - the basic features are still the same, even though the look and feel of the icons and menu bars may change depending on the UI design standards of the day. What has really changed over the years and releases of Crystal Reports is the functions and features that have been developed, culminating in a product that can easily hold its own with just about every other report writer on the market. To have a look at some of those features, we are going to delve in to just exactly what you can do with Crystal Reports.NET.
What Can You Do with Crystal Reports.NET?
To start with, Crystal Reports.NET includes an integrated Report Designer available within the Visual Studio IDE that you can use to create report files (.rpt) to integrate with your application.
This Report Designer (covered in Chapter 2) features a number of "experts" (or wizards) to help you get started creating a report and will guide you through the report development process, from selecting a data source and the field that will appear on your report, to determining what records should appear.
Once you have a basic report designed, you can then add features like formula fields, running totals, graphs, and so on to make your report design as complex as required. Reports come in all shapes, sizes and forms. You may want to create a report that can be used to print an invoice from your application or you want to compile statistics for a management report or produce an inventory count sheet. You don't even have to constrict yourself to a particular size or shape - reports can be created that print shipping labels or address labels and can include bar codes, pictures, graphics, and so on.
After you have created a report, you need some way to display this report from your application, and Crystal Reports.NET has two different viewers to make this happen. The Windows Forms Viewer (which we look at in Chapter 3) can be used with windows applications to preview any reports you have integrated into your application and features a rich object model that allows you to control the appearance of the viewer and some aspects of the report at run time.
You can add this viewer to any form in your application and either have it as the sole content of the form, or place it alongside other form components. You can control the viewer's appearance, changing toolbars, and other visual aspects, even creating your own icons and buttons to control the viewer and its actions.
For web-based application, there is also a Web Forms Viewer (Chapter 4) that has similar functionality and allows you to view reports you have integrated into your web applications. You can add this viewer to web pages within your application and show a report either on its own page, or in a frameset, or side by side with other application content - it is up to you.
For complete control over your report, regardless of whether your are viewing it through the Windows or Web Forms Viewers, you also have access to the Report Engine (see Chapter 8), which will allow you to control even the most minute aspect of your report before you view it using one of the aforementioned viewers. Using the Report Engine, you can control the report's formatting and features, set database credentials and call direct methods to print, export, and so on.
For creating distributed applications, Crystal Reports.NET has a number of features specifically designed for creating and consuming XML Report Web Services, either through a generic Web Service that ships with Crystal Reports.NET (which allows you to utilize a report without having to publish it as a Web Service) or by creating your own Web Services from report files. (In any case, Chapter 5 will guide you through the process of both creating and consuming XML Report Web Services.)
Finally, Crystal Reports.NET is also tightly integrated with Crystal Enterprise, a report scheduling and distribution system that provides a true multi-tier back-end processing platform for reports and allows you to use a scheduling engine and distribution framework to distribute reports to thousands of users.
If that wasn't enough functionality jam-packed into this release, there are also a number of tools included for distributing reports with your application that are covered in Chapter 9.
How is Crystal Reports.NET Different from Previous Versions of Crystal Reports?
Crystal Reports.NET is a brand-new product that is only available with the Visual Studio .NET suite. It shares some common features with the retail version of Crystal Reports and was built on the Crystal Reports 8.x technology, but components of Crystal Reports.NET have been re-written using C# and are designed to take full advantage of the .NET Framework.
Integrated Design Environment
Unlike the standalone versions of Crystal Reports, Crystal Reports.NET is part of the Visual Studio .NET Integrated Development Environment (IDE). Using the integrated Report Designer, you can create or modify reports from within the Visual Studio .NET IDE. (If you have used the Report Design Component from previous versions of Crystal Reports, the concept will be familiar.)
Any Language, Any Time
Keen to make amends to developers who have felt slighted in the past, Crystal Reports.NET follows the Visual Studio .NET mantra of "any language, any time" and is not too picky about the language you use to write reporting applications. For all .NET languages the report designer remains the same, and the code used to control viewing reports and report engine calls will only vary slightly between languages, due to different syntax rules and conventions. For example, if you were binding a report to a Web Forms Viewer in VB.NET, the syntax would look something like this:
crystalReportViewer1.ReportSource = my_Report1
While, the same code can be ported to C#, with only one rather minor syntax change:
crystalReportViewer1.ReportSource = my_Report1;
Clearly, it is going to be a lot easier to switch between languages when required - this also means that the ease of use that Visual Basic developers enjoyed with previous versions of Crystal Reports can be used across all of the .NET languages.
Another difference is that the way that we integrate reports into both Windows and web applications has changed. In the past, Crystal Reports developers had a number of different integration methods they could choose from for Windows applications, such as an ActiveX control, Automation Server, or direct calls to the Crystal Reports Print Engine. For web applications, Crystal Reports shipped its own web component server and report viewers, allowing developers to integrate reporting into their applications.
While the report integration solution provided for Windows development seemed to make most developers happy, the web integration provided with Crystal Reports left something to be desired. There were inherent problems with configuration, scalability, and reliability, meaning that the Crystal Reports web development platform could not be used to create scalable enterprise applications.
With the introduction of Visual Studio .NET, is it now possible to bring both Windows and web development into the same framework. The Crystal Report Engine is now a COM+ object wrapped around an updated version of the Crystal Reports Print Engine you may have worked with in the past. The Report Engine can be used to customize features at run time and also takes care of report processing.
When working with Crystal Reports for Visual Studio .NET, you have a choice of either leaving the report on the local machine (and using that machine's resources to process and display the report results using the Windows Forms Viewer), publishing it to a web server (and using the Web Forms viewer) or publishing it as a Report Web Service - which can be consumed and viewed by either the Windows or Web Forms Viewer.
Each of these integration methods will be covered in its own chapter, starting with Chapter 3: Report Integration for Windows-Based Applications.
Ease of Use
Integrating a report into a Windows application is as simple as dragging the Crystal Report Viewer from the toolbar onto a Windows Forms Viewer and binding the viewer to a report file. (You could also create a report using the integrated designer.) The Crystal Report Viewer shown opposite provides a feature-rich client for viewing reports and at design or run time you can customize the appearance and options of the viewer, pass parameters, set properties, and so on.
For web development, there is also a Web Forms Viewer that communicates with the Report Engine (either on the local machine or on a remote server) to display a report page in DHTML format. This allows you to quickly integrate reporting into your web applications - there are no runtime files required and the report processing can be performed on the server.
Building Enterprise Applications
In addition to these enhancements, Crystal Decisions has also released Crystal Enterprise - a scalable, platform-independent report distribution, scheduling, and processing engine that can be used in conjunction with Crystal Reports and Crystal Reports.NET to provide the back-end "muscle" to create applications that can support hundreds of users for both real-time and scheduled reports with a clustered, multi-server architecture that can span Windows, Linux, and Unix platforms.
Reports that have been published to the Crystal Enterprise framework can be accessed directly from within Visual Studio .NET, as shown overleaf, and integrated into your application.
In addition to providing a scalable, multi-tier back end for reporting applications, Crystal Enterprise also has its own security layer (which can use Windows NT authentication, LDAP, etc.), internal structures (folders, objects, rights), and a scheduling engine and distribution capabilities that can be used to build complex reporting applications without have to reinvent a solutions architecture just for reporting.
For example, if you needed to create an application that generates a report every week in PDF format and sends it as an e-mail attachment to 10 different users, you could create that functionality within your own application or you could use the inherent scheduling and distribution capabilities within Crystal Enterprise to make a handful of API calls to do this for you.
Another key area where Crystal Enterprise earns its money is with the clustering technology and multiple-server architecture - imagine in our example from above, there are now 10 reports that go to a hundred different people each day with a copy of the report and a link back to where they can view and search the live report.
The clustering within Crystal Enterprise ensures that these jobs get run regardless of what servers are up or down, and the distributed architecture means that you can add multiple servers to share the processing workload, including servers tasked to specifically run scheduled reports and process ondemand requests.
While the cost of Crystal Enterprise may be off-putting to some developers, its integration with Crystal Reports.NET and distributed architecture (which is beyond the scope of this book) will ensure that you have the scalability you need when your reporting application that serves 10 suddenly needs to serve 10 thousand.
When we look at Crystal Reports.NET, one of the immediate differences between this version and previous incarnations of the product is the ability to create multi-tier reporting applications. In the past, most Windows applications used a two-tier approach with Crystal Reports, where reports ran on the local machine where the application was installed.
Excerpted from Professional Crystal Reports for Visual Studio .Net by David McAmis
Excerpted by permission.
All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.
Chapter 1. Crystal Reports.NET Overview.
Chapter 2. Getting Started with Crystal Reports.NET.
Chapter 3. Report Integration for Windows-Based Applications.
Chapter 4. Report Integration for Web-Based Applications.
Chapter 5. Creating XML Report Web Services.
Chapter 6. Working with .NET Data.
Chapter 7. Formulas and Logic.
Chapter 8. Working with the Crystal Reports Engine.
Chapter 9. Distributing Your Application.
Appendix A. Troubleshooting.
Appendix B. Migrating Applications to Crystal Reports.NET.
Appendix C.Crystal vs. Basic Syntax.
Posted September 28, 2009