Combining Database Fields


Simply typing literal text into text objects is a waste of their capabilities! Text objects are powerful elements that can help you create very attractive reports. Consider Figure 2-1, the beginning of a form letter that uses the Customers table from XTREME.MDB (included with Crystal Reports ). Note the spacing problems with the contact name , city, state, and ZIP code. These lines are composed of separate fields from the Customers table. No matter how much you try or how creative you get sizing and moving these fields, they will not line up properly for every customer. They appear in the same horizontal location in every details section, no matter how wide or narrow the fields are sized .

click to expand
Figure 2-1: Spacing problems using database fields

This type of problem is a dead giveaway that this is a computer-generated letter. Although most consumers are savvy enough to assume that a computer had something to do with the form letters they receive, you don t want to make it obvious. Crystal Reports gives you a better way with text objects.

In addition to containing literal text, text objects allow you to combine database fields with literal text. When the text object appears, it automatically sizes the contents of the database fields so that there is no extra space. Figure 2-2 shows the same form letter as Figure 2-1, but a text object is used to combine the database fields with literal text and spaces.

click to expand
Figure 2-2: Spacing problems solved with text objects

To combine database fields inside a text object, follow these steps:

  1. Insert a text object, as described previously. If you need to include any literal text, you may type it either now or after you ve inserted the database fields. It doesn t matter whether you leave the text object in edit mode or end editing.

  2. From the Field Explorer, choose the field or fields you want to combine in the text object. Drag them from the Field Explorer into the text object. Note that your mouse cursor will change when you move over the text object, and a blinking cursor will appear in the text object at the same time:

  3. Before dropping the database field or fields in the text object, look very carefully at the location of the blinking text object cursor. Wherever the cursor is located is where the database field or fields will go when you release the mouse button. Release the button when the cursor is in the proper position.

  4. If you were already editing the text object when you dragged the database field into it, it will stay in edit mode. You may now type more literal text or add another database field, if you need to. If the text object wasn t in edit mode, the field will be dropped inside without going into edit mode. If you wish to add more text, double-click the text object to place it in edit mode.

  5. When you re finished combining database fields and literal text, end editing by clicking outside the text object.




Crystal Reports 10
Crystal Reports 10: The Complete Reference
ISBN: B005DI80VA
EAN: N/A
Year: 2004
Pages: 223
Authors: George Peck

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net