Welcome!

.NET Authors: David H Deans, Jayaram Krishnaswamy, Shelly Palmer

Related Topics: .NET

.NET: Article

Crystal Reports XI & How It Has Changed

New Life for an Old Friend

Microsoft's bundling of Crystal Reports dates to Visual Basic 3 and since then many developers have come to rely on it to build reporting solutions. Early on some developers found the programming API too complicated and there were the typical deployment problems that happen with any product that has many versions and upgrades. There have been many improvements over the years to address developer concerns, but when Business Objects acquired Crystal Decisions a little over a year ago Crystal Reports was revitalized. Developers will see these benefits in Crystal Reports XI and the upcoming release of Visual Studio 2005 (still in beta).

I'm going to focus on how Crystal Reports XI affects developers and how it can improve reporting applications. The features that I feel are most important to .NET developers are web reporting, dynamic cascading prompting, faster data connectivity, dynamic image location, easier deployment and improved export functionality.

The overarching change in the product is that tasks that used to take a lot of coding are now built in. For example, the following line of code is all you need to add a report to an ASP.NET page and have the user preview it:

<CR:CrystalReportViewer id="CrystalReportViewer1" runat="server" Width="350px" Height="50px"
ReportSource='<%# "c:\inetpub\wwwroot\ SampleReport.rpt" %>'/>

Adding reports to your application used to mean writing a lot of integration code. The sample above indicates how much easier it is to work with reports.

Web-based Reporting
Crystal Reports has been around for over a decade, and has a reputation for being a Windows reporting tool. But that's changing.

By improving the Web reporting features, integrating reports in an Internet application becomes trouble-free and a seamless user experience. Parameters are now supported on the URL that customize Web Service reports for the user. Business Objects wants you to choose Crystal Reports for reporting services and, as an incentive, are releasing a product called Crystal Reports Server for $7,500. It includes five concurrent access licenses (CALS) and free tech-support and maintenance for a year. Business Objects has drastically cut the price on previous Crystal enterprise offerings and made it practical for small to mid-sized businesses. As an added bonus, Web Services reports are 100%-compatible with ASP.NET Forms Authentication and don't require redundant logins. Users can access your Web Service reports and never know they're on a different server. Not all .NET reporting services support this level of integration.

Current Crystal Reports .NET Web applications mean writing additional code for printing from the browser. With Crystal Reports XI (and the future VS 2005), there's a Print button on the web toolbar. Professional-looking reports are sent to the client-side printer with no coding. What a relief!

There's also a new ActiveX viewer that highlights objects individually or in groups and then copies and pastes them into HTML or Rich Text format in applications such as Word, Excel and Outlook.

New Reporting Features
One major feature that developers have to look forward to is dynamic cascading prompts. Past versions of Crystal Reports supported parameters based on a static list embedded in each report, but you couldn't have a value in a pick list constrain the values shown in subsequent pick lists. You had to build this feature with custom forms. With dynamic cascading prompts you can now show a pick list based off of live data from your database without writing any code. You can also link prompts together so that a change in one prompt affects the other prompts. In the Crystal Reports Server edition, values in a pick list can incorporate view-time security so each end user can see a customized pick list based on his own security level. Pick lists can be shared in the BusinessObjects Enterprise XI framework to improve performance and reduce database access further. They can also be scheduled so users aren't querying a large dataset for lists of values that rarely change.

The following figure shows how to create a City prompt. The dialog box lets you make the prompt static or dynamic. It also shows you how it's linked to the two previous Country and Region prompts.

How many times have you tried to print dynamic images in your report but didn't want to save the binary data to your database?

The alternative is writing a lot of code to load the images dynamically into a DataSet object and pass it to the report. Crystal Reports XI lets you print images using a text link rather than embedding the binary data in the report or dataset. Dynamic image locations give you the ability to reference an image's location and display it in the report. The image can be on a local drive, network drive or referenced via a URL address. Plus the location is formula-based so you can use any built-in functions to derive the location string.

For example, the following formula uses a database field to display an image:

"C:\Program Files\Demo\" + {Product.Graphic Image Location}

This is a huge improvement that eliminates code in your .NET application and improves performance.

Crystal Reports for .NET made it easy to build reports from datasets and XML with just a couple of lines of code. But Business Objects, the new owner, completely rewrote its ADO.NET libraries for a huge performance increase. Visual Studio 2005 benefits because the new DLLs are included in VS 2005. There's also improved Microsoft Exchange 2000/2003 support. You can generate reports using multiple Exchange data sources such as Calendar, Journal, Tasks, Inbox, Address Book and Contact.

Users often want to take report data and manipulate it with the tools they're already familiar with. Crystal Reports supports exporting reports to PDF and the common Microsoft Office formats (Excel, Word, RTF, CSV). When exporting to Word with the RTF format, a couple of things are needed. First is an accurate report and second is easy editing.

A new export format has been introduced to cover cases where editability is most important (i.e., forms-based reporting). It doesn't use text boxes so it's easy for Word users to edit the exported document. By providing the most export options for Microsoft Office and better data connectivity to Microsoft Exchange, Crystal Reports gives you a tighter level of integration with Microsoft products than any other reporting tool available.

A feature that every developer will love is simplified deployment. There is only one merge module to deploy. In that module are properties that customize what libraries get deployed. No more trying to figure out what each merge module does and whether it's necessary or not. Crystal Reports also supports side-by-side deployment so DLL conflicts are a thing of the past. Developers can breathe another sigh of relief.

A question developers ask is how buying Crystal Reports affects their current application. Well, when you buy Crystal Reports and install it on your development computer, it recognizes if you have Visual Studio .NET installed and upgrades your .NET reporting libraries to the latest version. You get rid of the older DLLs and replace them with the new ones. Second, the integrated report designer is an improvement over the one that ships with .NET. Third, your .NET applications now share the same reporting engine as Crystal Reports XI and the reports are fully compatible with each other.

Choosing Which Version To Use
With the release of Crystal Reports XI there are significant changes in editions and packaging. The familiar Crystal Reports Standard and Professional editions offer a standalone report designer. The Developer edition has been expanded to include all the APIs required for embedding reporting into thick client applications and comes with new more flexible licensing terms for distributing reports over the Web. But, perhaps, one of the most exciting changes is the introduction of Crystal Reports Server, which includes report management, scheduling and Web distribution capabilities, as well as all of the APIs needed to integrate these capabilities into your applications. Meaning that as a developer, you no longer have to spend time building your own security and scheduling applications. Both the Professional and Developer editions come with a five named-user license for Crystal Reports Server that can be used in production, giving you the opportunity to create a reporting solution for a small number of users and decide whether to upgrade at a future date.

Overall, I think that Crystal Reports XI and the upcoming release of Visual Studio 2005 is a great benefit to .NET developers. Reports are much easier to create and require less code to run in an application.

More Stories By Brian Bischof

Brian Bischof, CPA, MCSD, is the author of the best-selling book Crystal Reports .NET Programming. You can download sample chapters and find out more information at his Web site www.CrystalReportsBook.com.

Comments (4) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
hakim jamali 01/09/08 04:07:49 AM EST

this article is informative accept one point which i noticed, that exporting to word is not availble in crXI. Only RTF editable export is available which loose the the basic formatting like table.

Rich 08/21/07 08:07:03 AM EDT

You mentioned in the article a figure showing dynamic cascading prompts, yet there is no figure??

chuck 04/23/05 09:18:20 PM EDT

I've used CR since VB 4. I've given up on it after using other reporting products. CR's object model for reports is way to convulted. Creating reports takes a long time. The worse part is changing datasources at run time (devlp to prod). Definitely look elsewhere if your doing Win forms, you have to install 4 merge modules. Other vendors have 1 dll. View the reports on the web is troublesome the dhtml they use is not that well formed.

Joel White 04/15/05 04:14:55 PM EDT

I've been using Crystal Reports since it was bundled with Visual basic. I recently purchased version XI and am somewhat dissapointed in the product (Mainly it's documentation). The documentation / help files are incomplete and are missing help about some export functions. And the documentation it does have is almost pointless to read, since it does not give a good description of the function and it's values.