Six Quick Crystal Reports Design Tips
 
Published: 27 Feb 2008
Abstract
Creating reports can be a daunting task. Reports can demand a great deal of effort and time, especially if you have not worked with Crystal Reports much. In this article, Jeff provides six quick Crystal Reports Design Tips to assist in creating killer reports with style and speed. Among other tips, you will learn how to add WaterMarks to your reports. Each tip has been deeply examined with the help of relevant explanations and screenshots for better understanding.
by Jeff McWherter
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 93462/ 81

Introduction

I have found myself working on projects where reports have been last minute additions that demanded a great deal of time and a certain touch of detail. Many times, reports are cobbled together, with good design and performance falling to the wayside.  Reports are the primary representation of the data on your system; after putting so much hard work into the application that is collecting data it is important to put a little extra effort forth to design truly "killer" reports for your application.

The development tips in this article are primarily intended for developers without much experience with Crystal Reports.  This article assumes the reader has a basic knowledge of Crystal Reports data access.

We will cover six quick tips that will enable you to quickly create reports that are richly featured. We will start with a basic report that a manager of a project may ask for; order fulfillment. The following examples will be created from the SQL Server 2000 Northwinds Trading Company sample database. The sample report referenced throughout this article pulls data from the Orders, Customers, and Products tables. The report is intended to be a representation of a typical order fulfillment report. It groups orders together, and displays information about each product under the order. The examples below are using Crystal Reports 2008, but have also been tested with Crystal Reports XI.

Using Templates

Using templates helps with one of the most important aspects of delivering quality products, being consistent. Crystal Reports 2008 ships with twelve built in templates, but the power comes from the ability to create your own templates. 

Report templates are existing Crystal Report (.rpt) files which will allow you to "inherit" many design related formatting settings including:

·         Page headers and footers

·         Color formatting

·         Charting settings

·         Lines, Borders and Boxes

·         Logos and images

·         Addition of Standard Functions

·         Addition of Special Fields

·         Field highlighting

Figure 1: A report that does not have a template applied

To apply a template, select the “Template Expert” found on the report menu.  

Figure 2: Crystal Reports Template Expert

 

To apply a custom template, select "Browse" on the Template Expert and navigate to an existing report you would like to use as a template for your new report. In our example we will use the "NorthwindTemplate.rpt" file.

Figure 3: A report with a custom template applied

The Northwind Template report file contained header information with company detail and a logo that our new report has now inherited.    

Copying with Formatting between fields

This tip may be one that many readers are already aware of, but it is still worth mentioning. Formatting objects on a report can be a tedious task, when there may be multiple formatting options applied to each object on your report. Including labels, the formatting may need to be applied to over a hundred objects on a report, which increases the possibility of errors. To help minimize errors, use the “Format Painter” tool.

Figure 4: Format Painter Tool

To use the "Format Painter" tool, follow the following steps:

1. Select an object from which to copy formatting.

2. Select the "Format Painter" tool from the menu.

3. The cursor will change to a paint brush; use it to select the object from which you would like to copy the formatting.

4. Double click the "Format Painter" tool from the menu.

5. Click on any other object to apply the formatting to that object.

Now the formatting from the original object you selected will be applied to each of the objects you select. To turn off the "Format Painter" tool, click on the tool again in the menu.

Evaluating Performance

It is important to monitor performance from the start of development when you are creating Crystal reports. This will save time later in the development cycle trying to figure out why a report is slow. Code profiling is the amount of time that various behaviors of your application take to run. You should be running a profiler on your SQL statements before the data even gets to the report, to be aware of how long your queries take to run. 

Crystal Reports provides a tool to estimate how long the report will take to load (render time). In my opinion if you are working with data and you’re not profiling your code then you’re not doing your job.

The Crystal Reports Performance Information tool can be found on the report menu.

Figure 5: Performance times for the order fulfillment report

So, what is an acceptable load time? It depends. Load times of not more than six seconds are a good goal, but there are always exceptions. Keep reports as simple as possible, and query only the data needed for the report. Use SQL to perform as many functions as possible before the data is passed to the report, such as ordering, or in some cases grouping data.  If you see a section of data that can be broken out into a new report, doing so may help with load times.

Highlighting Data

Often times the style of certain types of items needs to be changed to make them stand out on the report. This is commonly used to indicate negative numbers, or numbers over or under a certain threshold. Crystal Reports has built in support for this that makes this easy to accomplish.

In this example, the formatting of the "Units in Stock" objects needs to be changed when the value is less than 15. To accomplish this, first select the field by clicking on it once. Select "Highlighting Expert" from the Format menu; then select "New".

Figure 6: The Highlighting Expert

You will then be able to set options for when and how the highlighting will occur. For this example, I set the font color to red and the background to yellow, when the “Units in stock” object is below 15.

Figure 7: Highlighting when Units in Stock is below 15

Showing a Check Box on a Report

One of the most important things I have learned with Crystal Reports is that many times you need to “think outside of the box”. Crystal has support for Boolean operators to be displayed as the following:

True or False

T or F

Yes Or No

Y or N

1 or 0

Crystal Reports does not have built in support to display a check box for Boolean operators, but with a little creativity and the Wing Ding font, this task can be easily accomplished. The following example will illustrate how to use check boxes to replace true/false statements in the “Discontinued” field. The simplest way to accomplish this task is to change the display string of the value, and then set the font of the object to Wing Ding.  First a formula will need to be added to change the display text of the field. Right click on the Boolean field you would like to change, and select “Format Expert”. On the Common tab, click the X+Y button for the “Display String” option.

Figure 8: Format editor display string

Ensure that “Crystal Syntax” is selected and copy the following formula:

Figure 9: Changing the display string

The character code 0xFE in the Wing Ding font represents a box with check mark. In contrast, the character code 0xA8 represents an empty box. The Character Map tool, which can be found in the Accessories folder in the Windows Start menu, will assist you in discovering the hex values for character codes of the items you would like to display. After you have found the character code for the value you would like to display, add it to your formula. It is much simpler to use the decimal representation of the ASCII value instead of the hex value. This is a great site http://www.asciitable.com/ to find all of the ASCII values, including their hex and decimal representations. After you have set your formula, make sure you set the font for the object to Wing Ding, on the “Format Editor “screen.

Figure 10: The Windows Character Map tool

Figure 11: Fulfillment report with discontinued check boxes

Tool Tips

Objects on a Crystal Report allow for the addition of a Tool Tip. What’s great about features like this in Crystal Reports is the ability to apply formulas.  This example will illustrate how to add a Tool Tip to the “Units in Stock” field that will indicate how many units are on order when the user hovers over the object. The Tool Tip will generate this data from a formula.

To add a Tool Tip to a report object, right click your object and select “Format Editor”. Select the Common tab and click on the X+Z button next to the Tool Tip text box.

Ensure Crystal Syntax is selected, and enter the following for the formula:

Figure 12: Tool Tips for units on order

Figure 13: The Tool Tip over the Units in Stock field

Text Watermark

A common report request is the ability to add a watermark to a report indicating that it is a draft. This example will show you how to accomplish this. In order to create the watermark, create a new header section, add a text object for the watermark and select the “Underlay Following Sections” option. This allows for new header to be above the rest of the sections of the report.

Figure 14: The Section Expert

Figure 15: The watermark in the designer

The text object that was added has a silver 72 point font set, font spacing of 80 and the text turned 90 degrees. The text rotation option is found off the common tab in the Section Expert.

Figure 16: Fulfillment report with draft watermark

Don't forget that you can suppress sections in Crystal Reports via code if you would like to provide an option to print the report without the watermark. Suppressing sections through code is out of scope of this document.

Conclusion

The six tips in this article are just the tip of the iceberg when it comes to developing Crystal Reports. The tools available within Crystal Reports make it easy to design professional, scalable reports for those without a fine art degree or advanced-level knowledge.



User Comments

Title: Can's view the images of the article   
Name: Saif
Date: 2012-06-02 8:53:43 PM
Comment:
Hi,

I can not see the images of the article on below URL
http://aspalliance.com/1593_Six_Quick_Crystal_Reports_Design_Tips.6
for the topic "Showing a Check Box on a Report" Please help
Title: WaterMarks   
Name: Nitish
Date: 2011-12-16 3:34:03 AM
Comment:
On Figure 16, the watermark does not underlay the lines in the detail secion of the report. Is there a way to make this happen?
Title: developer   
Name: Durgesh dixit
Date: 2011-06-08 12:54:39 AM
Comment:
This artical is very helpful for us
Title: IT INCHARGE   
Name: RAJENDRA
Date: 2011-04-28 3:39:42 AM
Comment:
Thanks for the information
------------ Showing a Check Box on a Report
this is very very usefull to me
Title: It Consultant   
Name: Jerry Jesiolowski
Date: 2011-03-14 11:01:13 AM
Comment:
We are using Crystal Reports 2008. My question is can we install this on a Server such as Termial Servier where everyone could access the one copy and use the one copy of the SAP GUI as well. We are trying to keep lower our Total Cost of Ownership. If this can be done is there some features or subfeatures that might not be available. Our goal is to support up to serveral hundred power users. this implies the ability to create Crystal Reports.
Title: Mr   
Name: Todd Gen
Date: 2011-02-23 2:59:07 PM
Comment:
Awesome tips... Found very useful... Some others I find helpful are at http://www.bofocus.com
Title: Other Fonts Too   
Name: Greyhound
Date: 2010-08-18 10:42:36 AM
Comment:
GREAT!!! This opens the door to other symbols just by selecting other fonts. Thanks.
Title: DME Officer   
Name: Waqas
Date: 2010-08-03 8:06:07 AM
Comment:
When i entered above mentioned formula in crystal report 10 this gave me an error of "string missing". Please advice me that how can i get rid from this problem and can use this formula. Thanks a lot...
Title: Tricks   
Name: Crystal report designer
Date: 2010-08-02 2:37:06 AM
Comment:
Thanks a lot for the valuable information
Title: Six Quick Crystal Reports Design Tips   
Name: Vikas rathore
Date: 2010-07-28 8:56:38 AM
Comment:
Nice tips thanx
Title: Copy watermark   
Name: Priya
Date: 2010-05-03 1:28:44 AM
Comment:
Thats a nice article with simple explanation
Title: Watermark   
Name: kevin rogers
Date: 2009-11-25 4:35:03 AM
Comment:
really helped thanks
Title: Getting picture to underlay horizontal lines   
Name: Steve
Date: 2009-10-05 10:04:16 AM
Comment:
In figure 16, the horizontal lines get stuck "behind" the watermark. It seems that lines will do this, but the borders on text boxes do not. If you need a horizontal line, just create an empty text box and give it a top or bottom border, then put it where you need the horizontal line to appear.
Title: How can I change a date to the corresponding number?   
Name: Jay Thompson
Date: 2009-10-02 9:45:41 AM
Comment:
I have this formula:
{RO_ANInvoiceHistHeader.RentEndDate}-40086

It produces this:
01/12/1900

I would like for it to produce this:
13

I get the "13" once I export it to excel and reformat it to a number, but would like to get it to that number while it is in Crystal. How can I do this?
Title: Check Boxes   
Name: Joe
Date: 2009-08-13 4:21:47 PM
Comment:
This method is solid. The only problem I have is that when you are is design mode you see a string of wingdings not the check boxes.

In management reports that may not be to large of an issue. But if you are designing legal documents for example, you have 7 check boxes that are independently data driven. In design mode the layout would be confusing b/c you are not seeing the boxes, the layout takes longer, and maintining the doc long term may not be as easy.

This is how I do it. I too use the wingdings mentioned. I create a text field. I go the character map tool and select check box, then click select and copy. Now go back to CR, copy the clipboard into the text box. Do the same for the blank box to. So now have 2 new text boxes with box/chkbox. Position the blank box first. Once it is where you want it, right click and select Size and Position, note the X / Y coordinates and cancel. Now right click on the chkbox, and select X / Y coordinates. Enter the X / Y coordinates noted from the blank box. The last thing to do is add suppression logic to turn on/off the check box text fied. You don't have to add suppression logic to the blank box. It sits right under the chkbox, the size is controld by the Font sizer.

Also make it a little wider the the chkbox text box so that you will be able to select if you need to.

Hopes this helps.

Joe Cigno is a Crystal Reports developer with 15 years experience. He is availabe for contract work and support
jcigno@avalonsi.com
Title: Shared Variables   
Name: Pieter
Date: 2009-07-20 4:20:51 AM
Comment:
Hi, we would like to put a sub report into a sub report, but that's OK- the problem is putting Shared Variables in the report to read from sub reports into sub reports.
Title: Cygnet   
Name: .net development
Date: 2009-07-04 2:55:59 AM
Comment:
Great Post! Really very useful information is given. Thanks for sharing.
Title: A new Crystal Report Learner   
Name: kim
Date: 2009-04-29 5:19:58 AM
Comment:
Jeff,

I am a new to Crystal Report. I dont know how to create and design a report (.rpt)file for I dont know wich software or tools to create and design a Crystal Report. I am using Visual Studio6 for programming interface.

Please help me out with these things.

Thank you
Title: problem in gorup, afnd formulla in crystal report   
Name: subrat
Date: 2009-04-28 2:04:42 AM
Comment:
i've problem in Group field, formulla fiels of crystal report.
How to create and set group in crystal report
How to create and set formulla field in crystal report.
i've make a project using vb.net,sqlserver and maked connection between frontend and backend and also maked a connection to crystal report but i dont know how to set gorup field , how to set formulla field, how to calculate total field, average,sum....etc.

so i need your help to solve my problem
Thanks
Regards
Subrat kumar sar
United Arab Emirates
subrat_sar@yahoo.com
Title: Display String   
Name: Imran
Date: 2009-04-22 3:46:58 AM
Comment:
Hi

I'm similar problem, but I need to see one text field only in some cases for example.
if {abc}= 5 then
{def}.visible = true
else
{def}.visible = false

Imran,
Title: Crystal reports   
Name: Gopal
Date: 2009-02-28 6:06:44 AM
Comment:
nice to learn
Title: dotnet Devoloper   
Name: haneefa
Date: 2009-02-07 12:15:00 AM
Comment:
it is nice idea
thanks
Title: Make Crystal Reports   
Name: Uday
Date: 2008-12-23 4:57:17 AM
Comment:
This artical is very helpful for us.
Title: The Putxi Project   
Name: Putxi
Date: 2008-11-22 7:17:45 PM
Comment:
Very good article

http://putxiproject.co.cc
Title: crystal reports   
Name: Vishal
Date: 2008-11-19 12:55:45 AM
Comment:
good article
Title: Good article   
Name: RamkumarM
Date: 2008-11-03 5:47:46 AM
Comment:
Very nice
Title: VP/CFO, CIO   
Name: Lee Pavis
Date: 2008-10-31 4:32:24 PM
Comment:
New to Crystal and would like to see a demo with sample reports.
Title: Good Article   
Name: RD
Date: 2008-10-10 4:16:23 PM
Comment:
Informative article, with easy to understand examples. Great job.
Title: Thanks for the info   
Name: KA
Date: 2008-09-20 10:50:50 AM
Comment:
Thanks
For all of the tips these will be very usful,and defenitly ones I didn't know about. Its always nice to learn something new, keep up the good work!
Title: Thank for sharing youe EXP   
Name: thanan
Date: 2008-09-17 4:16:47 AM
Comment:
Great tips
Title: Watermark   
Name: gavin
Date: 2008-08-11 1:19:01 AM
Comment:
On Figure 16, the watermark does not underlay the lines in the detail secion of the report. Is there a way to make this happen?
Title: Crystal Report through click on gridview button   
Name: Saqib
Date: 2008-08-08 12:30:25 AM
Comment:
Hello,

I am using VS-2005 for creating my website.

My records display in gridview, and I created a link button name "PreviewQuotation" on gridview row for each record . On the other side I created a page to use crystal report viewer to show the selected record of the Gridview Row.

But I have no idea how to pass my Primary Key field value to Crystal Report page to preview the particular row recod when click on "PreviewQuotation" button on gridview.

Regards,
Saqib Malick
Title: Helpful Article   
Name: Dulce Bautista
Date: 2008-08-01 10:28:58 AM
Comment:
Great tips!
Title: using templates/background images for reports   
Name: sixela
Date: 2008-06-25 4:32:07 AM
Comment:
hi all, will it be possible to use templates/background images in previewing a report, but excluding it from printing? can i ask for references in suppressing sections through code? since watermarking images in reports might be one way to solve this problem...thanks!
Title: Working in Crystal report 8.0   
Name: JP
Date: 2008-06-23 8:36:38 AM
Comment:
I am using crystal report ver 8.0
I tried this but 'FORMAT EDITOR DISPLAY STRING" is not available. Could anyone suggest how it is possible???
Title: Crystal report 8,8.5,10 version   
Name: JP
Date: 2008-06-23 8:31:18 AM
Comment:
Does it work in crystal report 8.5 version? I didn't get
Title: ASP.net   
Name: Din
Date: 2008-06-12 10:37:08 AM
Comment:
jeff,
The solution is working in the design time of crystal reports, but when I viewed it CrystalReportViewer control in aps.net it shows the strange symbol perhapes it is not applying the wingding font in aps.net.
Any solution for that?
thanks,
Din
Title: Its Good article   
Name: Mukunda
Date: 2008-06-04 5:36:10 AM
Comment:
It's really a good article, add some more examples

Thanks
Mukunda
Title: Its very nice one   
Name: Jyotsna
Date: 2008-05-29 7:23:08 AM
Comment:
feeling good abt this article..very helpful
Title: Crystal report   
Name: Velika
Date: 2008-05-25 4:07:08 PM
Comment:
Thanks for this very helpful article.
Can you tell me how to count the record number(or groupnumber) for any group like this:
1.
1.1
1.2.1
1.3.2
Please help.
karno8400@yahoo.fr
Title: Good   
Name: Rajani
Date: 2008-05-22 6:53:02 AM
Comment:
It was good for desinging crystal reports in different way
Title: Good one   
Name: sneha
Date: 2008-05-15 8:34:19 AM
Comment:
Good one for the beginners....
Thanks it helped me too.
Title: Super   
Name: saima
Date: 2008-05-11 6:57:38 AM
Comment:
Its really super jeff. very helpful
Title: Six Quick Crystal Reports Design Tips   
Name: Shohagh
Date: 2008-04-24 1:04:15 AM
Comment:
ThankS for such an important post. It will help me designing a Crystal Report... ... ...
Title: Mr.   
Name: allanamk
Date: 2008-04-18 4:44:42 PM
Comment:
Hi

I tried that check box from the Windings in the Boolean format field -string formula from common tab...But still shows me 0 in the preview screen


Thanks
Title: Mr.   
Name: allanamk
Date: 2008-04-18 2:17:43 PM
Comment:
This is really nice support to novice and vatirans.

Thanks
Title: Six Quick Crystal Reports Design Tips   
Name: saaden
Date: 2008-04-17 6:28:14 AM
Comment:
I need to start,so
It's really a good starting step.
Title: Tips on Crystal Reports   
Name: John
Date: 2008-04-16 10:39:38 AM
Comment:
Great tips thanks.
Title: Thanks   
Name: Mukunda
Date: 2008-04-15 11:21:18 PM
Comment:
Its good article,it's helps me.
Title: Thanks   
Name: Narendra
Date: 2008-04-02 9:13:27 PM
Comment:
It's really a good article,it's helps both beginers and develeopers
Title: Thank you   
Name: Ajeet
Date: 2008-03-28 11:07:08 AM
Comment:
Thanks Jeff, that was helpful.
Title: Crystal Report   
Name: Janu
Date: 2008-03-25 7:08:22 AM
Comment:
Excellent
Title: Crystal Report   
Name: Seema
Date: 2008-03-24 6:14:46 AM
Comment:
Hi,
It is really excellent.
Title: version of CR?   
Name: Eric Moreau
Date: 2008-03-11 8:04:22 PM
Comment:
Which version of Crystal Reports your article is focusing on? The one provided with VS2008?

Product Spotlight
Product Spotlight 



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


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-25 1:04:46 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search