Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

SHARED COMPUTING SERVICES

Crystal Reports, Level 100


Basic Level
Updated 12/14/05

Create a Simple Report


Start a New Report Get help from
1. When choosing a data source, you can choose from the following categories: www.CrystalDecisions.com
• Favorites – bookmarks or favorite shortcuts
• History – recently accessed connections
• ODBC (Open DataBase Connectivity) – server-based databases like Oracle MS-SQL
• Database Files – data files that run from your computer or a network such as MS Access
• More Data Sources – lists all other data sources such as MS Outlook, Web/MS ISS log files, etc.
• Metadata/Query – locate and list Crystal Dictionaries or SQL queries designed with SQL Designer
2. OPTIONAL: Right-click the database and select Add to Favorites…
3. To select a table to use for the report, expand list of tables and select the appropriate table for report and then click > .
4. Click Finish .

Place Fields on the Report


1. Open the Field Explorer window.
2. To add a field to the report, select the field and then:
• Click Insert Field and then click in the report where you want the field to appear
• Press ENTER and then click in the report where you want the field to appear
• Right-click and select Insert and then click in the report where you want the field to appear
• Double-click field in list and then click in the report where you want the field to appear
• Drag-and-drop the field onto the report where you want the field to appear

Browse Field Data Create Text Objects


1. Select a field in the Field Explorer window.
1. Click Insert Text Object
2. Click Browse 2. Click where you would like the text object to appear.
3. Click Close when finished viewing. 3. Type the text to appear.
Use Guidelines to Move and Align Objects
Select, Size, Move and Align Objects Objects will snap to Guidelines for easier alignment.
• Select a field to format by clicking it. Objects can be aligned left or center to the guideline.
• Select multiple fields by holding SHIFT or CTRL when • To see tails in Design view, go to the File menu, select
clicking to select OR draw a selection marquee around the Options then Show Guidelines in Design.
objects. • Add additional guidelines by clicking the ruler where
• Right-click a multiple object selection to align and size. you want the guideline to appear.
• Be sure the cursor is a four-headed arrow when moving • Move guidelines with click-and-drag.
objects and not resizing. • Pull the guide off the ruler to delete it.
• Resize objects with the two-headed arrow using the resizing • Right-click a section and select Arrange Lines to view
handles (dots) on the edges and corners of a selected object. vertical guidelines.
• Use Zoom to view all fields if necessary.
Crystal Reports 9
Level I, Basics

Save the Report Preview the Report


When you preview a report, Crystal Reports uses cached data.
1. Click Save (if you have not saved and named the
report, the Save As… dialog box will open). • To view current data, click Refresh .
2. To turn the Autosave feature on, go to the File menu and • To automatically discard saved data and pull new
select Options. On the Reporting tab, select Autosave data from the database whenever you open the
Report After ___ Minutes. Enter the number of minutes report, go to the File menu and select Options. On
the Autosave is to active in the blank field. the Reporting tab, select Discard Saved Data When
Loading Reports)
• Navigate pages of report using the navigation buttons

Formatting Features
Use the Report Template Expert Format Objects
1. Right-click an object and select Format… or Format
1. Click Template Expert
Text…
2. Choose a template from the list, then click OK . Format common, border, font, paragraphs,
If you wish to undo the template, click the Template Expert hyperlinks, date/time or number style.
button and select Undo current template and then click OK .

Insert Lines, Boxes and Images


1. Click Insert Line . 1. Click Insert Box 1. Click Insert Image
2. Click-and-drag to draw line. 2. Click-and-drag to draw box, 2. Navigate to the folder and image,
3. To format, right-click the line and encompassing all objects to be select the image and click OK .
select Format Line… included in the box. 3. Click in the report to place the
3. To format, right -click the box image.
and select Format Box…

Adjust the Page Setup


1. To change the page’s orientation, go to the File menu and select Printer Setup…
2. Choose the appropriate options and then click OK when finished.
3. To change the page’s margins, go to the File menu, select Page Setup…
4. Type the page margins you desire for the report.
5. Click OK when finished.

Work with Text Objects


You can place fields inside text objects to concatenate (merge) data field with text you type. Crystal Reports will automatically trim the
field for each value it represents so there is no extra space at the end of the field when you print the report.
1. Create a text object.
2. Type any necessary text.
3. Double-click the field to add in the Field Explorer window.
4. Move the mouse cursor to the text object (Your mouse cursor should be an arrow with a plus [+]).
5. Click in the text object to add the field after the text you typed.
6. Continue with steps 2-5 until complete.

Format Part or All of an Object

page 2 Shared Computing Services


Crystal Reports 9
Level I, Basics
To format the entire text object, select the object and use the To format part of text object, you must be in Edit mode. To get to
tools from the Formatting toolbar OR right-click the object Edit mode, double-click the object. You may now select specific
and select Format Object… text or fields using the same principals as mentioned above.

Place Special Fields


Special fields include page numbers, file path/name, file creation date, print date, record number, etc. You place a special field the same
as placing a data field as mentioned on page 1. Just like data fields, special fields can also be placed inside a text object.

Filter, Group and Sort Data for a Summary Report


TIP: By default, selection is case
Filter Data with the Select Expert insensitive. To change, go to the
File menu and select Options
1. With no fields selected, click Select Expert . (To save time, if the field to filter by is and remove the check mark for
part of your report, right-click the field and choose Select Expert….) Case-Insensitive SQL Data.
2. Select the field to filter by and then click OK .
3. Select a comparison operator from the dropdown list.
4. Select from the data provided in the criteria dropdown list(s) or type your own and then click OK .
• To add criteria, click the <New> tab or New… in the Select Expert dialog box and then repeat steps 2-4 for the new criteria.
• To change the statement, click Show Formula ››› to expand the dialog box and view the formula.
o Change the statement from AND to OR.
o Delete parts or change parts of the statement.
Record Selection Formula Templates
1. From the Report menu, move to Edit Selection Formula and select Record.
2. For more on formula, see Create and Use Formulas on page 4.

Create and Sort a Group Sort Records within a Group


1. Click Insert Group 1. Click Sort Order
2. Select the field to group by from the top drop-down list. 2. Select the field to sort by from the Available Fields: list.
3. Choose the sort order from the bottom drop-down list. 3. Click Add › to move the field to the Sort Fields: list.
4. Click OK when finished. 4. Under Sort Direction: select either Ascending or
• To modify the group selection, right-click the section Descending.
header (not the field) and select Change Group… 5. Click OK when finished.
• To add sub-groups, repeat steps 1-4. Be sure to add the
groups in order of importance as each additional group
will be nested within the previous group. Summarize Groups and Add a Grand Total
• To reorder the groups, click-and-drag the Group
Header section (not the field) in Design view and move 1. Click Insert Summary OR right-click the field,
it to the new location. move to Insert ` and select Summary… OR from the
Insert menu, select Summary.
Use the Group Tree to Navigate the Report
2. Choose the field to summarize.
In the Field Explorer window, expand the section for Group
3. Choose the calculation for this summary.
Name Fields. This creates an easy navigation tree for viewing the
4. Choose the location (section) for the summary to appear.
groups in your report. Just click the name of the group in the
Group Tree and you’ll quickly navigate to that area of your 5. Click OK when finished.
report.

Shared Computing Services page 3


Crystal Reports 9
Level I, Basics
Group Data in Date/Time Intervals Format Date/Time Fields
1. Right-click Group Name field and select Format Field…
1. Click Insert Group 2. Click Customize on Date and Time tab in Format
2. Select the field to group by from the top drop-down list. Editor.
3. Choose the sort order from the bottom drop-down list. 3. On the Date and Time tab, select an order and/or
4. Choose the interval for which the report will be printed. separator if necessary.
5. Click OK when finished. 4. On the Date tab under Format:, select the format for the
month, day and year.
5. Click OK in the Custom Style dialog box.
6. Click OK in the Format Editor.
Order Groups Based on their Subtotals
Calculate Percentages
Using the Sort Group Expert
1. Click Insert Summary OR right-click the field,
move to Insert ` and select Summary… OR from the 1. Click Sort Group Expert OR from the Report
Insert menu, select Summary. menu, select Sort Group Expert…
2. Choose the field to summarize. 2. Under For this group sort choose the top, bottom or
3. Choose the calculation for this summary. percentage.
4. Choose the location (section) for the summary to appear. 3. The based on field appears for you to choose the field
5. Select Show as a percentage of and choose the total or for comparison.
group on which you want the comparison to be based. 4. Type the number groups to appear for Where N is:
5. Deselect ; Include Others to hide data not in selection.
6. Click OK when finished.
6. Click OK when finished.

Linked Tables and Formulas


Create a Report with Linked Tables
1. Start a new blank report, select the tables to use for the report and then click > .
2. Click the Links tab and view the links between tables.
3. Click OK when finished.
Understand Crystal Formula Syntax without Being a Programmer
Formula Syntax Rules Example
Fields Fields are enclosed curly brackets {table.FIELDNAME}
Other Formulas You can add formulas within other formulas. The formula name {@FormulaName}
must be preceded by the @ symbol and surrounded by curly
brackets.
Functions Always enter functions with the FunctionName followed by one FunctionName(argument,argument)
or more arguments placed in parenthese and eparted by
commas.
Numbers Numbers must be entered with no commas. 1000 or 10000
Text Text must be added within single or double quotation marks. “ABC”
Operators Syntax rules allow you to place a space before and after an + - * / % < > =
operator or omit spaces.
// Comments may be added to formulas by begging the line with //This is a comment
two forward slashes. If you create complex formulas, it is a good
idea to commentate them.
Capitalization Formulas are NOT case sensitive. Caps and lower case are NA na
considered the same
Returns and The Formula Editor ignores hard returns ENTER or spaces used to ( ), { }, “ ”, ‘ ’, or [ ]
spaces make the formula more readable. Use returns and spaces to
make the formula easier for you to read. Do not insert a return
between any open /close bracket characters

page 4 Shared Computing Services


Crystal Reports 9
Level I, Basics
Create a Calculated Field
1. Click Formula Workshop

2. Click the palette arrow next to New in the Formula Workshop dialog box and select Formula…
3. Type the name of the formula and then click Use Editor .
4. Create the formula.

5. When finished, click Check . A message box will appear to notify you if there are errors in your formula, click OK .

6. Click Save and close the Formula Workshop.


7. In the Field Explorer, expand the Formula Fields list.
8. Drag-and-drop the new formula field onto the report. Formula fields can be formatted just like any other field.

Manipulate Dates with Formulas


Date Functions
CurrentDate Produce a date based on your computer system’s date.
ToText (x,y) Convert a date value into a text value. It also allows us to format the value to display any or all portions
of the date.
Date (yyyy,mm,dd) Used to specify a date value in a format that Crystal Reports recognized. Each value must be a number.
Year (x) Evaluate a date value and return the year in a number format. Year ({Date}) returns 2004 if the date falls
in the year 2004.
Month (x) Extract the month the date falls in. Numbers returned are 1-12.
Day (x) Extract the day the date falls in. Numbers returned are 1-31.

Character Example
d day of month without leading zero for single digits 1
dd day of month with leading zero for single digits. 01
ddd day of week as a three letter abbreviation Mon
dddd full name of day of week Monday
M month without leading zero for single digit 3
MM month with leading zero for single digit 03
MMM month as three letter abbreviation. Mar
MMMM full name of month March
yy last two digits of year 04
yyyy full four digits of year 2004
h hours without leading zeros for single digits (12 hour) 4:00
hh hours without leading zeros for single digits (12 hour). 04:00
H hours without leading zeros for single digits (24 hour) 16:00
HH hours with leading zeros for single digits (24 hour) 16:00
m minutes without leading zeros for single digits 0:5
mm minutes with leading zeros for single digits 0:05
s seconds without leading zeros for single digits 0:3
ss seconds with leading zeros for single digits 0:03
t, tt single character or multiple character a.m./p.m. string

Shared Computing Services page 5


Crystal Reports 9
Level I, Basics

Create String Formulas


Operator/Function
+ Concatenate operator is used to string together text fields.
“ ” Quotes are used to surround literal text
[ ] Subscript operators are placed immediately after a field name and are used to signify which
characters you want from the field’s value.
ToText Convert number, currency, date, time and date/time values to text strings. Multiple arguments (x,y)
vary to support the type to values being converted.
IsNull Check to see if a field contains a value. When used alone, it returns a Boolean value of True or False.
Often used with If…then…else… operators as the test portion.
If…then…else… Allows you to do different things in a formula based on conditions.
Length Count the number of characters in a string value, or sometimes used when a formula requires a
value to be a certain length.
Picture Display a string value in a set format. Such as converting a string of numbers to a typical telephone
number format.
Left(string,#places) Similar to Subscript operator, but it always starts with the first character on the left and displays ho
ever many characters are indicated by the #places argument.

Use Bookmarks to Navigate Through Formulas


• In the Formula Workshop – Formula Editor, place the insertion point where you would like the bookmark to appear and

click Toggle Bookmark .

• Use Next Bookmark and Previous Bookmark to move between bookmarks

• Click Clear All Bookmarks to delete all bookmarks.

Conditional Formatting
The Highlighting Expert
Limited to number/value fields and can only test against hard coded numbers. NOTE: Highlighting
uses the absolute
value, which may vary
1. Select the field for condition, then click Highlighting from the value
2. Choose a comparison operator from the Value is: field. displayed since the
3. Type the appropriate criteria in the next field. displayed value may
4. Select the formatting to be applied when the condition is met. be rounded.

5. Click OK when finished.


• Use the © and ª Priority arrows to change the priority of the criteria in the Item list.

Format Sections Conditionally Format Fields


With formulas, you can conditionally format any type of field and
1. Click Section Expert OR right-click the section you can make any kind of test you need, as long as you can specify
name and select Format Section…
the condition using the Formula Editor.
2. Select the formatting to be applied.
1. Right-click the field to format and select Change Font…
• To conditionally format, click Formula Editor
2. Click Formula Editor for Color:
for the appropriate field and create the formula, then
3. Type formula here. (See Tables and Formulas on page 4
save and close the Formula Editor. (See Tables and
for more information.)
Formulas on page 4 for more information on creating 4. Save and close formula.
formulas.)
5. Click OK when finished.
3. Click OK when finished.

page 6 Shared Computing Services


Crystal Reports 9
Level I, Basics

Create Summary Reports and Charts


Create a Summary Report
• Right-click section name and select Suppress (No Drill-Down) so this section is not visible.
• Right-click section name and select Hide (Drill-Down OK) to view section headings with no details. This allows you to
expand (drill-down) to view details of a specific group. A magnifying glass will appear when your mouse hovers over a section
you can drill-down to the details for.
• When you drill-down, a tab with the summary information for the group will appear. This tab will remain until you delete it.
• To close the tabs, click r in the navigation area.

Create a Chart Edit Charts


1. Click Insert Chart • Right-click the chart and select Change
2. Deselect Automatically set chart options to enable the Options Border… for borders and shading options.
tab. • Right-click chart and select Chart Expert… to
3. Select the chart type in the Chart Type: list and the sub-type. change the chart type and other options.
4. To be sure the graph will print only once per report in the • Double-click a data series in the chart to drill-
header, the grouped field must show in the On change of: field, down and view the details.
and a summary field shows in the Show: field.
5. On the Options tab, select options you like. TIP: In Design view, the chart is
6. On the Text tab, you can adjust the chart titles. represented with sample data. To
7. Click OK when finished. view the actual data, switch to
Preview.
Modify the Chart
Format Charts Title
Choose a Chart Template 1. Right-click the chart and select Format
1. Right-click the chart and select Format Chart/Titles…
Chart/Template… 2. Type the new title.
2. Select the chart types in the Gallery to view options 3. Click OK when finished.
for each, and then select your choice. Modify Chart Options
On the Custom tab, select the categories and scroll 1. Right-click the chart and select Format
through to view the chart types in each category Chart/General… Different options will be available
3. Click OK when finished. depending on the chart type and other options you’ve
• To remove formatting, click Undo. selected.

Analyze Charts
1. Right-click the chart and select Chart Analyzer…
2. Right-click a pie piece to change and select Format Chart/Selected Item…
3. Choose the color, texture, pattern, or gradient you want.
4. Right-click a pie piece and select Format Chart/Series…
5. Drag the Detach Slice slider bar to explode the piece.
6. Click OK when finished.
• Close the Analyzer by clicking r in the navigation area.

Export Report Results


Use HTML Format for Crystal Reports
1. Click Export OR from the File menu, move to Print and select Export.
2. Change Format: to HTML 4 (DHTML).
3. Choose Destination: location.
Shared Computing Services page 7
Crystal Reports 9
Level I, Basics
4. Click OK when finished.
5. Export to Directory dialog box opens, click OK after changing any settings you desire.

Export to an Application Export to a Report Definition Format


1. Click Export OR from the File menu, move to 1. Click Export OR from the File menu, move to
Print and select Export. Print and select Export.
2. Change Format: to Excel. 2. Change Format: to Report Definition.
3. Choose Destination: to Application. 3. Choose Destination: to Application.
4. Click OK when finished. 4. Click OK when finished.
5. Format Options dialog box opens, click OK after
changing any settings you desire.

Set Options and Use Report Experts


Set the Default Layout for Design and Set the Database File Location
Preview Views 1. From the File menu, select Options.
1. From the File menu, select Options. 2. On the New Reports tab, select the default destination
2. On the Layout tab, select any options you desire. for reports.
3. Click OK when finished. 3. Click OK when finished.

Set the Database and Reporting Options Set Field and Font Defaults
1. From the File menu, select Options. 1. From the File menu, select Options.
2. On the Database and Reporting tabs, set more 2. On the Fonts tab, click Field Titles…
advanced options such as SQL/OBDC database 3. Select desired options.
options, the method to sort and display table and
4. On the Fields tab, click Number… to open the Format Editor.
field name, how to handle Date/Time strings and
whether or not data will be saved with the report. 5. Select desired options.
3. Click OK when finished. 6. Click OK .
7. Click OK when finished.

Create a Report Using the Standard Report Expert


1. Click New OR from the File menu, select New.
2. Select Standard Expert then click OK .
3. On the Data tab, click Database to open the Data Explorer.
4. Navigate to the database and add the table(s) you desire.
5. Click Close .
6. Click Next ›› .
7. Select the fields to display, then click Next ›› .
8. On the Group tab, select the field(s) to group on and then click Next ›› .
9. On the Total tab, select the field(s) to summarize and the correct operator.
10. Make any other necessary changes on the Top N, Chart or Select Tabs tabs if desired.
11. On the Style tab, add the report title and any images if needed, and format as desired.
12. Click Finish .

page 8 Shared Computing Services

You might also like