Crystal Reports 7 with CD-ROM

Crystal Reports 7 with CD-ROM

by George Peck, Peck

The most definitive resource on Crystal Reports available!

Create presentation-quality reports from virtually any database using the most powerful data analysis tool and this authoritative guide. Crystal Reports 7: The Complete Reference explains in detail how to use the software to analyze and format data,generate reports,and perform advanced interactive

…  See more details below


The most definitive resource on Crystal Reports available!

Create presentation-quality reports from virtually any database using the most powerful data analysis tool and this authoritative guide. Crystal Reports 7: The Complete Reference explains in detail how to use the software to analyze and format data,generate reports,and perform advanced interactive reporting from the Web. The book also illustrates how to develop custom applications and incorporate any Crystal Report into your Windows applications — without leaving the Visual Basic development environment. Complete with bonus CD-ROM containing free Seagate software,VB code,utilities,and a sample Web site,this is a resource no Crystal Reports user should be without.

Inside,you'll find out how to:

  • Perform powerful data analysis and create professional-quality reports
  • Report directly from data sources—including SQL databases—easily
  • Maximize report flexibility with advanced formulas and sophisticated reporting techniques
  • Use the query,reporting,and multidimensional OLAP features of Seagate Analysis
  • Integrate reports into Visual Basic application using the ActiveX Report Designer Component,as well as other integration methods
  • Execute interactive,web-enabled reporting with the Crystal Web Reports Server or Microsoft Visual InterDev and Active Server pages

Product Details

McGraw-Hill Companies, The
Publication date:
Complete Reference Series
Edition description:
Product dimensions:
7.45(w) x 9.13(h) x 2.21(d)

Related Subjects

Read an Excerpt

Chapter 2: Enhancing Appearance with Text Objects

...Combining Special Fields

You're not limited to combining database fields inside text objects. You can use special fields as well. Special fields are system-generated fields, such as the Print Date, Print Time, Page Number, and Total Page Count. You may place them directly on the report, just like database fields. And, like database fields, you'll encounter spacing problems if you try to place them near literal text.

To combine special fields with literal text inside text objects, perform the same steps as for database fields, but instead of dragging and dropping fields from the Insert Fields dialog box, drag them from the Insert I Special Field pull-down menu option and drop them inside the text object.

Figure 2-3 shows the benefits of combining special fields with literal text in a text object.

There are several pointers that will help you as you combine fields and literal text inside text objects.

  • If you place a database or special field in the wrong location inside the text object (say you place the Last Name field in between the letters "a" and "r" in the word "Dear"), you can simply use your cursor keys, and the BACKSPACE or DEL key to make the correction. In this case it is easier to just delete the text following the special field, and re-enter it before the special field. You may also Use CTRL-C to cut text and CTRL-V to paste text inside the text object.

  • If you inadvertently drop a subtotal, summary, database field, etc., inside a text object by mistake (it's pretty easy to do, even if you're careful), you have two choices. If you catch the problem immediately, you canchoose Edit I Undo, or click the Undo button on the Standard toolbar. The field will move back where it was before. However, if you notice that you accidentally dropped a field inside the text object after it's too late to reasonably undo it, edit the text object, highlight the field that was mistakenly added by clicking on it, and press the DEL key. The field will be removed from inside the text object. You will then need to recreate it again and place it in its correct position on the report.

The Can Grow Formatting Option

When you combine database fields or special fields inside text objects, Crystal Reports turns on the Can Grow formatting option automatically. You can turn it back off or change the Maximum Number of Lines option from the Format Editor. To display the Format Editor, use one of these options: select the text object and then select Format I Format Text from the pull-down menus; right-click. on the text object and choose Format Text from the pop-up menu; or click the Object Properties button on the Supplementary toolbar. The Can Grow option is found on the Common tab of the Format Editor.

With Can Grow turned on, the text object will automatically grow taller to show all the text inside it. You can specify the maximum number of lines that the text object will grow, or leave the number set to zero for unlimited size. When Can Grow is turned on, the text object will only display as wide as it appears on the report. However, it will word-wrap at spaces in the text, creating additional vertical space up to the maximum number of lines.

This automatic behavior lets you size a text object to only one line high. If the contents of the text object can be displayed in one line, the text object will remain one line tall. If it needs more lines, it will expand only by the amount of vertical space necessary to show the material inside the text object (limited by the maximum number of lines).

Tip: Can Grow is helpful for other types of objects as well, not just text objects. You can set the Can Grow formatting option for string fields and memo fields. This is particularly helpful for "description" or "narrative" types of fields that could contain as little as a few characters and as much as several paragraphs of text. Can Grow isn't available for any type of object other than a text object, string field, or memo field.

Formatting Individual Parts of Text Objects

You can format a text object as you would any other object, using the Format toolbar or Format Editor. When you select a text object and change the formatting, such as setting a color or font size, the entire text object takes on that format. This may be the behavior you want.

However, there are other times that you may want certain characters or words in a text object to take on different formatting than the rest of the text object. Even more prevalent is a situation where you need to format individual database fields or special fields that reside inside a text object.

For example, when you insert the Print Date special field inside a text object, it will take on the default formatting from File I Options, perhaps a "mm/dd/yy" format. If you select the text object and display the Format Editor, there is no Date tab in which to choose an alternate date format-this is a text object you're formatting! Similarly, if you've placed a number field inside a text object, you may want to change the formatting to show no decimal places or to add a currency symbol.

To accomplish these types of formatting tasks, you must format individual parts of the text object. This is actually quite simple. Start editing the text object by doubleclicking it. You are then free to select individual characters or words by dragging over them with your mouse or holding down the SHIFT key while using the cursor keys. You can then use the Format toolbar or Format Editor to change the formatting for just those selected characters.

To change the formatting of a database or special field inside a text object, edit the text object and then click the field you wish to format. You'll know you've selected the field when it becomes highlighted. You can then use the Format Editor (either from the Format menu or by right-clicking—the number formatting buttons on the Format toolbar won't work here) to change the format of the object.

Performance Considerations

Text objects provide a powerful, flexible way to improve the appearance of your reports by combining fields and literal text. However, the cost of that flexibility is performance. Crystal Reports must perform a lot of internal calculations to combine and resize text objects on the fly. The result is performance degradation when you view the report in the Preview tab.

The degradation depends on a great number of factors, such as the processing speed of your machine and the overall complexity of the report. The problem is most acute when there are more than just a few text objects that combine fields, and when those text objects are located in the Details section. This requires Crystal Reports to perform the text object manipulation every time it prints another database record.

The following points will help you minimize performance problems related to combining fields inside text objects.

  • Use them sparingly, particularly in the Details section. You'll notice much less performance degradation if you only use these techniques in headers or footers, because Crystal Reports won't have to perform the text object manipulation as often.

  • If you do have a large number of items that need to be combined inside the Details section, consider using formulas instead. Formulas are much better optimized in Crystal Reports, so you won't notice nearly as much performance degradation. Formulas are covered in Chapter 5.

  • Avoid using the Total Page Count special field or Page N of M special field on the report (for example, "Page 1 of 182"). Using this in combination with text objects that combine fields can be a performance "kiss of death" for your report. Not only does Crystal Reports have to perform all the text object manipulation before it can show you a report page, but it has to format every page of the report, as well. This combination will often have you clicking the Stop button (remember, it's next to the Last Page navigation button) on a regular basis.

Tip: These performance issues only arise when you're viewing a Crystal Report online when the report is being viewed in the Preview tab or as a compiled report (covered in Chapter 13). If you're going to print the report on a printer or export it to another file format (also covered in Chapter 13), you needn't worry about these performance issues. They won't affect you...

Customer Reviews

Average Review:

Write a Review

and post it to your social network


Most Helpful Customer Reviews

See all customer reviews >