Adding Data Fields to a Report
Once you have a new report with a data source displayed in the report design view, you will then need to place fields from the data source into the desired sections of the report to display the data. You use the “Field Explorer” to add data fields to the report from the connected data source.
In the “Field Explorer,” you actually have a few different ways to add data fields to the report. First off, you need to display the data fields from the associated table or data source. Click the small plus sign next to the “Database Fields” icon to display the table or tables within the underlying data source that you added to the report through the “Database Expert.” Click the small plus sign next to the name of the table whose data fields you wish to access. The fields of the table will then be displayed.
You can add one of the displayed fields to your report by selecting the name of the field that you wish to add to the report from the “Field Explorer” and then clicking the “Insert to Report” button in the toolbar at the top of the “Field Explorer” window. You can then click into the report section where you wish to place the field.
Another way to add fields is to click and drag the field that you wish to add to the report from the “Field Explorer” into the desired section of the report. You may also simply right-click the name of the field which you would like to add to the report, and then choose “Insert to Report” from the pop-up menu that appears. Then click into the report at the location where you wish to insert the selected field.
Most of the time, the data fields from the table will be placed into the “Details” section of the report. Note that as you place the fields into this section of the report, Crystal Reports will add a text “header” for each field into the “Page Header” section. That way, when the report is previewed, you will see the label for each column of data at the top of the page and the associated data will be displayed once per record in the data source down the page, under the label.
To remove a field that you have added to a report, click the actual field that you inserted to select it. Then you can simply press the “Delete” key on your keyboard to remove it from the report design view. Notice that deleting the field will also delete the field header that was also automatically added, as well.
Browsing Field Data
Sometimes you would like to see the data contained within a field that you are going to place into the report design view. You can select the name of a field within the “Field Explorer” and then click the “Browse” button that appears in the toolbar at the top of the “Field Explorer” pane to display the data in a separate browsing widow. This window will then show the first few records of data contained within the selected field. You will also see the data type of the selected field displayed at the top of this small window. Viewing the data can give you a better idea of how wide to make the fields within the report design view. When you are finished previewing the data in the browsing window, you can simply close the window to return to report design view.
Selecting, Moving, and Resizing Fields
Once you have fields placed into the report design view, you may need to change their position and size on the page. Before you can make any editing changes to a field, however, you need to select it first. You can click a field to select it. When a field is selected it will appear with a blue border around it in the report design view. You will also see four small squares around the perimeter of the object, one on each side of the field. These are called the “resizing handles.” You use these to change the height and width of the data field.
If you need to deselect a field that you selected, you can click into the empty space within a report section to deselect the currently selected object or objects.
You can also select multiple objects simultaneously within a report. When you have multiple objects selected within a report, whatever action you then take is applied to all of the selected objects. This can be a useful way to delete several report data fields at once, versus deleting each one independently. You can also use it to apply a formatting style, like bolding, to several simultaneously selected fields.
To select multiple fields at the same time, click the first field which you would like to select. Then hold down either the “Shift” or “Ctrl” key on your keyboard while you continue to click the other fields that you would also like to simultaneously select. Then you can release the key that you were holding down when you have finished making your selections.
Another method of selecting multiple adjacent (next to each other) objects is to use a selection marquee. Hold your mouse pointer over the blank area in the section of the report where the fields that you wish to select are located. Then click and drag your mouse pointer, noticing the selection marquee that is being created as you continue to click and drag. Simply continue to click and drag the mouse through any fields that you wish to select. Any fields that are touched or enclosed by the selection marquee that you draw will become selected when you finally release your mouse pointer.
You may also easily move the selected fields that you have placed into your report. Simply place your mouse pointer over any selected field or fields in the report design view. When you see a four-pointed arrow appear as your mouse pointer, click and drag to move the selected fields and release them in another area of the report. You could also just select the fields and then use the arrow keys on your keyboard to move the fields up, down, left, or right.
You can also use the guidelines that appear in the ruler at the top of the report design view to move fields to the left and right. Using this method ensures that both the title and the data appear with the same alignment in the same column. Remember that when you insert a new field into the “Details” section of a report, Crystal will automatically create a label for the data which it places into the “Page Header” section. Notice when it does this, it will also place a small guideline marker into the ruler for the field. The marker looks like a small “home plate” from baseball. If you are familiar with Microsoft Word, you will think it looks like the “first line indent” character. You may click and drag this guideline left and right on the ruler to move both the data field and the label in tandem. However, it is important to note that when you manually click and drag on a field to move it, you then break it away from the aligning guideline. Therefore, using the guideline will not affect the field that you moved by hand after that. You will see a small red indicator at the left side of any field that is aligned to a guideline. You can re-associate a field with a guideline by manually moving the left edge of the field onto the guideline. When you place it into the correct position and then release it, you will see the red indicator appear at the left side of the object if you dropped it into the correct position. You can then use the guideline to move the field.
You may also add and remove the guidelines freely in the report design view. To add a guideline, simply click into the ruler at the position where you wish to place the guideline. To remove a guideline, click and drag the guideline from the ruler and release it into the report design section.