Vous êtes sur la page 1sur 17

Ohio University

Computer Services Center


August, 2002
“Crystal Reports Introduction”
Quick Reference Guide

Open Crystal Reports


From the Windows Start menu choose Programs
and then Crystal Reports.

Creating a Blank Report

Once you have chosen to create a New Crystal


Report document, the Data Explorer dialog box
opens. If you are accessing a database, choose
Data base files by either
• Double-Clicking the Database Files Folder or
• Clicking on the Beside the Database Files
Folder

Choose the correct database from the file in the


same manner.
This is the window that will pop up automatically
when Crystal Reports begins. Choose the option You now have access to the tables located within
to create a blank report. Crystal Reports offers the database. Choose which tables you would
you 3 options at this time. like to use for your report.

Choose the As a Blank Report option and then When a table has been selected correctly, a green
click OK. checkmark will appear on the inserted table.

Choosing a Data Source Click on Close in the Data Explorer window. You
are ready to begin formatting your report.
The first thing you must do once you have created
a report is to choose the data source. Note: If your computer is already configured to
access the OU data warehouse then it will show
up under the ODBC (Open Database
Connectivity) folder and can be found by clicking
the Icon in front of the ODBC folder and
choosing ORDJ.

Ohio University Technical Support 593-1222

1
Choosing Fields for Report
Now that you have chosen your data source, it is
time to design your report.

The Browse Field Data dialog box will display on


the screen showing three things:
1. The actual data
2. The size of the data
You should see the Field Explorer window on your
3. The type of data
screen.

To open the database you must either: Inserting Fields into a Report
• Double-Click the Database Fields or
• Click on the beside the Database Fields There are several options for inserting fields into a
report. The options are:
Once the data base is opened you then • Select the field you would like to insert then
• Click on the plus icon beside the database click the Insert Fields icon on the Field
you would like to pull fields from. Explorer.
• Select the fields of data you wish to use in • Select the field, press the enter key, and then
your report. Your database fields should look click in the report where you would like the
like this (Fields are circled): field to appear.
• Double click on the field, and then click in the
report where you would like the field to appear
• Drag the field to the report. When your
pointer is located exactly where you would like
the field to be placed, release the mouse
button.
• Right click on the field and choose the option
of Insert from the Short Cut Menu. Then, click
where you would like to place the field in the
report.

Your report is divided into five sections.


Browsing Field Data 1. The Report Header
2. The Page Header
Sometimes you may want to examine the size of
3. The Details
the data within a field before actually inserting it
4. The Page Footer
into a report. To do this:
5. The Report Footer
• Select the field you would like to browse.
• Click the Browse Data icon . When you are inserting fields you typically want to
place them in the Details section of the report.
When a field has been successfully inserted into

2
your report the field will display with a green You may also choose the field with the size that
checkmark . you desire all of your selected fields to be and
change all of your selected fields to that size.
Once you have placed a field in the Details Crystal allows you to do this using the shortcut
section, you will notice that Crystal Reports menu.
immediately places a field header in the Page
Header section. Do this by:
• Selecting the fields you wish to resize
• Right clicking on the field that has the size you
desire all of your selected fields to be
• Choose Size, and Same Width, Same
Heights, or Same Size

Moving and Aligning Fields


To move a single object you must:
• Select the object you wish to move and
position the mouse directly over the object
until a four-headed arrow appears.
• Left click the arrow and move the object to the
desired location.
Resizing Report Fields
When moving objects one at a time, the fields in
Resizing fields is important in order to maximize
your report tend to get out of alignment with their
the space on your report. You resize a field by:
titles. Crystal allows you to align multiple objects
• Selecting the field you wish to resize, and
by using the shortcut menu.
sizing handles appear at the center of each of
the four sides.
First you must select your objects by either:
• Clicking the first object you wish to align and
• Move your mouse over a sizing handle and a then pressing SHIFT or CTRL while you
double-headed arrow appears. select the other object/s you wish to align.
• Left-click on the arrow and resize the field to • Drag a marquee around the objects you wish
the size you desire. to align. Make sure that your mouse pointer is
not pointing to an object when you begin
When you resize a field located in the Details dragging. The marquee you drag selects any
section of your report, you also want to ensure field that it touches or contains.
that the field header (located in the Page Header
section) resizes with it. Once you have selected the objects you wish to
align
You can select multiple objects to resize by either: • Right click on the field with the desired
• Clicking the first object you wish to resize and alignment.
then pressing SHIFT or CTRL while you • Choose Align from the shortcut menu, and
select the other object/s you wish to resize or then choose to align on left, right, center,
• Drag a marquee around the objects you wish etc…
to resize. Make sure that your mouse pointer Note: These are the same processes you use for
is not pointing to an object when you begin resizing report fields.
dragging. The marquee you drag selects any
field that it touches or contains. Viewing the Report

Once you have selected the multiple items, you Once you have placed information within the
will notice that the resizing handles appear on the report you are able to view what it currently looks
item last selected. Resizing this item will resize all like. Viewing your report early on helps to
that you have selected. determine how you will proceed in perfecting and

3
enhancing the appearance of the report. To view
your current report you must:
• Select the Print Preview icon on the
Standard Toolbar.
• A new tab is created called Preview.

• Wait for your report to generate and view it!

Some reports may take several minutes to


generate if the data fields are large. If you would
like to stop your report from fully processing in
order to quickly view a portion of it you can. Do
this by:

• Clicking on the Print Preview icon to


prepare to view your report
• Click on the Stop icon in the upper right
hand corner of the report screen.
• Browse your report.

This will stop your report from processing further.


Once you determine that the report is producing
the information you desire and you want to go
ahead and generate it fully you must:

• Click the Refresh Data icon in the


Standard toolbar.
• You will be given the following prompt:

Select OK to proceed with refreshing the data.


• Wait for your report to finish processing and
browse the report.

4
Formatting objects within your report can be done
Styling the Report by using the Format Editor.

Using the Report Style Expert

The style expert contains many pre-formatted


styles. To open the Report Style Expert you must
either:
• Choose Format/Report Style Expert from the
Menu bar or
• Click on the Report Style Expert icon
located in the Supplementary toolbar.

When you open the Report Style Expert, Crystal


Reports warns you that it is not possible to undo
the commands initiated by using the Report Style
Expert. The warning appears below:

In order to open the Format Editor, you must right


Note: Because of this, it is recommended that click on the object you wish to format and select,
you save your document before you make depending on what type of object you have
changes using the Report Style Expert. If you do selected, Format Field, Format Text, or Format
this, you can always revert to the original report. Object. Whatever you have, the Format … option
opens the Format Editor.
Click Yes and the Report Style Expert window
appears. The Format Editor dialog box presents several
different formatting options depending on the type
of field you are attempting to format.

Adding Lines and Boxes to Your


Report
Crystal allows you to precisely add a line or a box
to your report. Add them by
• Clicking the Insert Line icon or the Insert
Box icon on the Supplementary Toolbar.
Note: Your mouse pointer changes to the
shape of a pencil.
• Draw the line or box with the mouse pointer.
The left column lists the style options you have to Edit the line or box by right clicking on them and
choose from. Select one and the image appears choosing the Format Line or Format Box option
in the graphic on the right. Click OK to apply the from the menu.
style to the report.
Inserting a Graphic into Your Report
Formatting Objects
Insert a graphic file into your report by:

5
• Clicking the Insert Picture icon on the The orientation section is in the lower right hand
Supplementary Toolbar. side of the Print Setup dialog box.
• Choose the location of your graphic and click
Open. Changing Margins
• Click on your report to determine the
destination of your graphic. Crystal, by default, sets the report margins to the
narrowest possible settings available on the
You may resize or move the graphic just as you printer. To change report margins, chose File
would any object in the report. from the Menu bar, and Page Setup.

Auto-Arranging the Report


Auto-arranging the report does three specific
things:
1. It trims the fields in your report to the shortest
possible length.
2. It specifies a consistent amount of spacing
between the fields.
3. It centers everything between the report
margins.

To apply auto-arranging to your report:


• Click on the Auto-Arrange icon in the
Supplementary Toolbar. Type in the settings you desire and click OK.
Note: Crystal warns you that this command
cannot be undone (like the Style Expert
Command).
Inserting Text Objects
• Click OK and the report is auto-arranged.
Insert text into your report by:
Working with Page Commands • Clicking the Insert Text icon on the
Standard Toolbar.
Changing page Orientation Note: The text box appears at the end of your
mouse pointer.
You can choose the page orientation (Portrait or • Click the location in the report where you
Landscape) by clicking on File from your Menu would like the text box to appear.
bar and Printer Setup.
Inserting Special Fields
Crystal Reports contains several special fields
that are unrelated to fields within the database.
The special fields included are the following:

6
• Click the plus icon beside the Special
Special Field Description Fields to see the fields.
Page Number Automatically prints • Insert the special field in the same manner
number on each page that you would a database field (See Page
Total Page Count Calculates and prints two of this document).
total report pages.
Page N of M Inserts page number
with a page count (ex:
Page 2 of 6).
Report Title Places the report title
as indicated in
File/Summary Info.
Report Comments Places the report
comments as indicated
in File/Summary Info.
File Path and Name Inserts the file path and
name of the report
File Author Inserts the author as
indicated in
File/Summary info
File Creation Date Inserts the date the
report was created
Print Date Takes the date from
your PC’s calendar
Print Time Takes the time from
your PC’s clock
Data Date Prints the date the data
was last refreshed
Data Time Prints the time the data
was last refreshed
Modification Date Shows the date the
report was last saved
Record Number Assigns a number to
each record in the
report and acts as a
counter field
Group Number Allows numbering of
each group in the group
header or footer
Record Selection Inserts Record
Formula Selection formula as
created in the Record
Selection Formula
Editor
Group Selection Inserts Group Selection
Formula Formula as created in
the Group Selection
Formula Editor.

To add a special field, open the Field Explorer by:


• Clicking the Insert Fields icon on the
Standard Toolbar.

7
Selecting Specific Records Once your field is selected you must choose the
conditions you would like to apply to the sort. The
Selecting Using a Single Criteria Select Expert initially displays the “is any value”
operator. The operators included within the
Filtering records allows you to limit the data in Crystal Reports Select Expert tool are the
your report based on certain conditions. To filter following:
records in Crystal Reports, you use the Select
Expert. To open the Select Expert, you must Operator Definition
either: any value Indicates that no conditions are
• Choose the Select Expert command from the applied to the data in this field.
Report Menu, or All records display in the data
field.
• Choose the Select Expert icon from the equal to Choose a certain value and only
Standard Toolbar those elements matching that
value exactly display in the field.
If you do not have any fields selected in the report
one of Displays records with one of
when you initially opened the Select Expert then
several values.
the Choose Field dialog box will appear:
less than Displays records less than a
certain value.
less than or Same as above but includes the
equal to stated value.
greater than Displays records greater than a
certain value.
greater than or Same as above but includes the
equal to stated value.
between Selects records that fall between
two certain values.
starting with Selects records that begin with a
certain character or set of
characters.
like DOS characters like “?” or “*”
can be used to select records
with similar but not identical
values.
From here you must: in the period For Date or Date/Time fields,
• Select the field you would like to sort from use this operator to determine if
• click OK and the Select Expert dialog box a date falls within a specified
appears: range.
Formula Allows you to create selection
statements that are more
complex than simple comparison
operators.

Note: Operators are specific to the type of field


selected to filter on. The pull down menus for
numeric or currency fields will only display
numeric currency operators.

Note: If you already have a field selected prior to


opening the Select Expert, Crystal Reports
assumes that is the field you would like to sort
from and automatically takes you to the Select
Expert dialog box.

8
Selecting Using Multiple Criteria
Sometimes it is necessary to sort using more than
one criterion. This can be done through the
Select Expert by:
• Clicking on the New tab or New button.

Note: The Show Formula button becomes a Hide


• Select the field you wish to include in the sort Formula button once the selection formula is
and click OK. This inserts another tab into the displayed.
Select Expert dialog box.
When you choose to sort using more than one
Editing Selection Criteria criterion, the Select Expert only chooses the data
meeting all criteria by creating an “and statement”
Once you have created selection criteria you may within the selection formula. If you wish to view
need to change it for one reason or another. This records meeting one criteria or the other then it is
can be done simply by: necessary to change your selection formula to
• Opening the Select Expert tool include an “or statement”.
• Clicking on the tab containing the information
you would like to edit. And Statement
• Edit your data and click OK. • Records must meet all criteria to be selected
• Always gives the same number or fewer
Note: Once you click OK, Crystal may prompt you records than when sorting with a single
with the following: criteria
Or Statement
• Records can meet any of the criteria to be
selected
• Always displays the same number or more
records than when sorting with a single
criteria

If the data you want is completely contained within


the saved report, you can use saved data.
Otherwise, you must refresh the data. If you are To change the criteria from an and to an or
unsure, ALWAYS choose to refresh the data. statement, you must:
• Manually edit the formula by changing and to
Viewing and Editing the Select or
• Click OK
Formula • Refresh your data.
Note: Crystal asks you if you would like to use
You can view the selection formula and edit it by
saved data or if you prefer to refresh your data.
clicking the button in the Select You must refresh your data to get the additional
Expert. records you are asking for.

9
Using Formula Templates
You may also choose to insert formulas into your
report. This can be done by:
• Clicking in the Report menu
• Choosing the Edit Selection Formula option
• Choose the Record option

The Crystal Reports Online Help should now be


displayed. To access the formula templates from
the Online Help you must:

The Record Selection Formula Editor opens.


Formulas can be entered using the full range of
report fields, functions, and operators. Crystal
Reports has several formula templates built into
the User Guide and Online Help file. These
templates can be used as guides in creating your
own formulas. Open the Crystal Reports Help by
doing one of the following:
• Pressing F1 key on your keyboard
• Expand the Record Selection option
• Selecting Crystal Reports Help from the Help
• Expand the Using formula templates option
menu
• Expand Record selection formula Templates
• Clicking on the Help icon located in the
Standard toolbar and clicking anywhere on You can select and copy any formula from these
the report. help screens into your selection formula using
copy and paste commands.

10
Keep Group Together – Assures that page breaks
Grouping and Sorting will not separate groups. Use this option ONLY if
your groups are small. If you turn this feature on
Creating a Group and you have a group that is longer than one
page, Crystal will move the entire group to the
Once you have determined that you would like to next page.
insert a group into your report, you must either:
• Press the Insert Group icon located on the Repeat Group Header – If you have large groups,
Supplementary toolbar or you may want the group header to appear at the
• Choose the group command in the Insert top of each new page to identify the group. This
menu. feature will do this automatically.

When a group is created Crystal adds two


additional sections to the report.
1. A Group Header
2. A Group Footer
Note: Objects in these sections print once at the
beginning and end of each new group on the
report. Crystal automatically adds the name of
the group in the group header as well.

Once your group is created you can edit it by:


• Right clicking on the gray area of the Group
Header #1 section and
The Insert Group dialog box appears. This box • Choosing the Change Group option from the
gives you the option to choose the field in which shortcut menu.
you want to group as well as allowing you to
define sorting and other options. Creating Multiple Groups

There are four choices used to determine the sort Crystal lets you create as many groups as you like
order of your group. They are: within a report. Multiple groups are nested inside
1. In ascending order one another. Each successive group is contained
2. In descending order completely in the group previous to it.
3. In original order
4. In specified order Crystal numbers the Group Header and Footers to
distinguish between the multiple groups.
In addition to the sort choices, there are two
additional check boxes for the following features:

11
box, you can list the records in ascending or
descending order on a specific field. Open the
Record Sort Order dialog box by either:
• Clicking the Sort Order icon located
on the Standard toolbar, or
• Opening the Report menu and choosing
Sort Records option

Using the Group Tree


The easiest way to navigate through your groups
is by the Group Tree feature.

The Record Sort Order dialog box opens. To sort


on a field, select it from the left list, and then click

the button. The order in which you


add fields is the order in which they will be sorted.
If you would like to delete a field the select it and
click the button.
The Group Tree appears at the left hand side of
the screen in the preview window. It works like a Summarizing Group Data
directory tree, showing a heading from each group
in the report. If a group contains another group, a Once you have grouped and sorted the records
plus icon appears before the group. Clicking within your report, you may wish to insert
on this will show the subgroups. summary data. Inserting summaries is a very
helpful tool. Summary information displays
When you see the group you want to view in the automatically in the Group Header of the report
report, click the group name in the Group Tree. and can perform numerous calculations.
Crystal then displays the chosen group. Using
this makes it easier to maneuver around a large Summaries can be performed on any type of data.
report.
On string data, summaries are limited to:
Reordering Groups • Counting
• Selecting the frequency
It may be necessary to change the order of your
groups once they are created. To change the On numeric data, summaries can calculate:
order of your groups you must: • Sums
• Return to Design View • Averages
• Click on the Group Header or Footer • Minimums
• Drag the Group to the location you wish • Maximums
• Counts
Sorting Records within a Group • Statistical Analyses

Crystal only gives choices that are appropriate for


If a sort order is not specified, Crystal displays the
the type of data you are summarizing.
records in the order in which they appear in the
database. Using the Record Sort Order dialog

12
To summarize the report (after the report has
been grouped) you must do one of the following:

• Click the Insert Summary icon located in


the Standard toolbar.
• Right click on the field (within the Details
region) and choose Insert Summary from the
submenu.
• Select the field you wish to summarize and
then click on the Insert menu and choose
Summary.

The Insert Summary dialog box will appear.

Crystal does not allow you to choose the field on


which to summarize from the Insert Summary
dialog box. You must select the field before you
choose to insert a summary.

Note: Summaries are based on groups. If you


insert a summary without first creating a group
then Crystal will automatically insert a group into
your report.

13
the field on which to group and Crystal puts all
Glossary records with the same value in that group.

Absolute Formatting – The data field formatting Group Header and Footer – The Group Header
option that can only be turned on or off based on and Footer are sections that appear at the
the presence or absence of ad attribute. beginning and end of each group in the report.

Between – An option in the Select Expert box. If Then Else – These formulas describe conditions
Choose records that fall between certain values. that control the display of data. These formulas
are helpful to bring attention to high or low
Boolean Expression – A Boolean expression is an performance. Example: If last year’s enrollment
expression that defines a logical relationship was less that 1000 Then make the value bold and
between two or more items. This type of italicized, Else (otherwise) make no changes.
expression always results in a TRUE or FALSE,
YES or NO answer. Keep Together – This option refers to keeping a
section together in relation to page breaks. If
Check Boxes – Boxes found in many formatting there isn’t enough page left to print the section,
and editing options that allow the user to turn a then rather than having the page break occur in
feature ON or OFF. the middle of the section, the entire section is
carried over to the next page.
Conditional Formatting – Conditional Formatting is
formatting that applies only if certain situations Last Modification Date/Time – Shows the
occur. Example: Formatting a numerical field in date/time when the report was last modified based
red if it is negative. on the PC’s clock.

Data Source - A particular set of tables, queries, Null – There is no data within the cell, not that the
dictionaries, or stored procedures that provide data value is zero.
data for a report.
Operators – Symbols that describe an operation
Data Date – Prints the date that the data in the or an action to take place between two or more
report was last refreshed. values. Operators are + - * and / < > = etc…
Syntax rules allow you to place a space before
Data Time – Prints the time the report data was and after an operator if you wish.
last refreshed.
Order of Precedence – A set of rules that
Data Type – A data type is a classification of data determines the order in which arithmetic
that appears in a field or formula. Data is one of operations are performed within a formula. Note:
the following types: string, currency, number, Multiplication and Division before Addition and
data, date/time, time, or Boolean. Subtraction.

Details Section - Details contains a row for each Page Header and Footer – These sections define
record returned from the database. items that will appear at the top and bottom of
each report page.
Export – Exporting is to distribute the report to a
disk file or through email to a different format. Print Date/Time – This inserts the date/time you
are printing the report, based on your PC clock.
Fields – Fields are accumulations of data about a
particular subject stored within a database table. Report Header and Footer – These sections
Fields are selected and placed on reports in a define items that will appear at the beginning and
variety of ways. In formula creation, fields are end of the report.
always shown within {curly braces}.
Report Gallery – A dialog box that appears when
Group – A group is a set of records that are you begin to create a new report that allows you
related to each other in some way. You specify to define how you are going to create the report.

14
Sections - The sections of your report are the
names seen in the Design Screen on the left side
of the window. Report Header, Page header,
Details, report Footer, and Page Footer.

Select Expert – Allows you to determine how data


will be displayed on your report.

Strings – A series of textual characters that are


letters, numbers, or special characters.

Summary Fields – A summary field determines


the sum, average, minimum, maximum, or count
of values in a group. Summaries are based on a
field within the details section of the report.

Suppress – Found within the Section Expert.


Suppress works like a hide feature but the section
is permanently suppressed and drill-down
capabilities are not allowed.

TopN – A function allowing users to make the


report display only the highest or lowest values.

Total Page Count – Calculates and prints the total


pages in the report.

ToText – A versatile function often used to convert


a date value into text.

15
Standard Toolbar Buttons Section Expert

Select Expert
The Standard toolbar contains icons for basic
editing commands. Sort Order

Create a New Report Insert Chart

Open a Report Insert map

Save Find

Print Zoom Control

Print Preview Help

Export Formatting Toolbar

Refresh
The Formatting toolbar contains various
Cut formatting commands. Most of these icons are
not active unless you have a specific object
selected.
Copy (Example: The Currency icon will only be active
on numeric fields)

Paste
Font Face
Undo
Font Size
Redo
Increase Font Size
Insert Hyperlink
Decrease Font Size
Insert Field
Italics
Insert Text Object
Underline
Insert Summary
Align Left
Report Expert
Align Center

16
Align Right TopN Expert

Currency Object Properties

Thousands Separator Link Expert

Percent

Increase Indent

Decrease Indent

Highlighting

Toggle Group Tree

Toggle Supplementary Toolbar

Supplementary Toolbar

The Supplementary toolbar displays at the bottom


of your Crystal Reports screen, and can be
activated by clicking the Toggle Supplementary

toolbar icon on the Formatting toolbar.

Insert Line

Insert Box

Insert Picture

Auto-Arrange Report

Insert Group

Insert Subreport

Insert Cross-Tab

17

Vous aimerez peut-être aussi