Customizing Crystal Reports

snortfearServers

Dec 4, 2013 (3 years and 11 months ago)

130 views

Customizing Crystal Reports



v1.1

Page
1

of
37

Introduction


Welcome! This document introduces you to customizing Crystal reports for use with AU Meds. We have included a number of pre
-
made reports with AU Meds, but if you have the capability of creating your own Crystal Reports, this document helps
you integrate them
with AU Meds. We chose Crystal Reports because:




it is the world’s standard for desktop reporting



it gives you the maximum report
-
writer capabilities



it’s a reliable, “been
-
there, done
-
that” interface. Once you learn Crystal, you can

apply it as a report writer to most databases.


Because of it’s power and adaptability (and your obvious bravery for deciding to create your own reports), we recommend that
you take
a class on Crystal Reports or ask for help from your I.S. department.


C
rystal Reports itself needs very little introduction
-

it's a recognized leader among report generators. If your only experience with
Crystal Reports is with versions prior to 8.5, forget everything you know and get it; there's no comparison between vers
ion 8.5 and
earlier versions.



Seagate Software, the company that produces Crystal Reports, was recently renamed Crystal Decisions. The release of Crystal R
eports
8.5 quickly followed, but it's much more than a simple interim version. Though the applicati
on is backward
-
compatible with Crystal
Reports 7.0, if you have an earlier version, there are many new features that make an upgrade to version 8.5 an excellent dec
ision.
Although the ability to integrate reporting and analysis into intranet, extranet, and

portal applications with Crystal Enterprise is reason
enough, Crystal Reports 8.5 now supports cross
-
platform development, with support for Windows NT, Windows 2000, and UNIX. OLAP
support is also much improved. There are enhancements to the Report Desig
ner, analysis tools, export formats, and report viewers.


All of the examples in this document were created using Crystal Reports 8.5.
To modify existing reports or create and add additional
Crystal Reports, you must have Crystal Reports 8.5 installed on

the same PC as the application.


What Does It Do?


An ambitious product, Crystal Reports 8.5 has very versatile reporting capabilities. As with this application, you can use Cr
ystal Reports
as a stand
-
alone report generator. Crystal Reports 8.5 goes far

beyond database and PIM support to include Lotus Notes and Domino,
Microsoft Exchange, Microsoft IIS, Microsoft SMS, Windows NT event logs, and NCSA
-
format Web server activity logs. When you do
need to pull data from a SQL database, Crystal Reports can ha
ndle XML, OLAP, and relational data sources.


Crystal Reports excels at publishing data. You can create presentation
-
quality reports and publish those reports to the Web in seconds.
There are many options for exporting reports: PDF, HTML, DHTML, XML, RTF,

Microsoft Word, Microsoft Excel, a variety of text
formats, a variety of e
-
mail formats, etc.


With Crystal Reports 8.5 you can deliver rich, interactive content via the Web using Web reports that go far beyond static ta
bles and
forms. Available report v
iewers include a Netscape plug
-
in, Java, ActiveX, and DHTML. Interactive viewers let users drill down on charts
and subreports, and even perform local printing and local exports.


Crystal Reports 8.5 is not just a stand
-
alone report generator. It also int
egrates with Microsoft Office 97 and Microsoft Office 2000.
Crystal Reports 8.5 takes advantage of Office's Add
-
in technology to automatically add report design capabilities to Excel and Access.
Creating a report is as simple as selecting a spreadsheet, ta
ble, or query, then launching the Crystal Report Wizard.


Installation of version 8 could be, well, exasperating. Once you got version 8 loaded, the system was so extensive it was dif
ficult to figure
out where to start. Quite to the contrary, installation

of version 8.5 is quick and easy. And because version 8.5 includes a familiar
Microsoft Office look and feel, getting started is equally as easy.


Crystal Reports 8.5 is available in three editions that progressively add more capabilities. The Standard E
dition provides report design
and report publication features. The Professional Edition adds Web publishing features. The Developer Edition includes powerf
ul
development tools and samples. The professional and developer editions of Crystal Reports 8.5 in
clude a five
-
user license for Crystal
Enterprise. Crystal Enterprise replaces the Web capabilities from earlier versions of Crystal Reports with a new Web
-
based report
Customizing Crystal Reports



v1.1

Page
2

of
37

publishing system. Crystal Enterprise can be deployed in single server or multi
-
server e
nvironments, and it's cluster
-
enabled. The result
is highly scalable and reliable information reporting.


How Good Is It?


I tested Crystal Reports 8.5 on two machines: a 750 MHz Pentium III laptop with 256 MB of RAM running Windows 98, and a dual
866
MH
z Pentium III processor server with 1 GB of RAM running Windows 2000 Server. Both delivered good, reliable performance.


Crystal Reports 8.5 is impressive, but not perfect. Version 8.5 corrects some obvious blemishes, but there are a few features

that sti
ll
need work. One is the way Crystal Reports handles multi
-
line text boxes. If you want your text boxes to grow, and you want to stack
them vertically, you need to separate them into distinct sections to prevent text bleeding across text boxes. Microsoft A
ccess reports
handle "can grow" text boxes much more gracefully (If I’ve lost you by now, then PLEASE, PLEASE take a class in Crystal or se
ek I.S.
help).


With versatile reporting capabilities, Crystal Reports is a recognized leader among report generators
. Version 8.5 is more than a simple
interim version. New features include the ability to integrate reporting and analysis into intranet, extranet, and portal app
lications with
Crystal Enterprise. In addition, it now supports cross
-
platform development, wit
h support for Windows NT, Windows 2000, and UNIX. It
continues to be the product of choice for adding powerful reporting capabilities to your applications.


Crystal Decisions

Phone:

(800) 720
-
8586

Web Site:

ht
tp://www.crystaldecisions.net


Rough ideas on price: When I last checked,
Crystal Reports 8.5 Standard was US$200; Crystal Reports 8.5 Professional, US$400;
Crystal Reports 8.5 Developer, US$500. Upgrades and multi
-
user licenses are available for the Pro
fessional and Developer editions.
Though you can use Standard, I recommend Developer.


OK,OK you’ve decided to buy Crystal (you had to anyway to get this far). You may have even taken our advice and took a class

or
asked the I.S. department for help.
Now what?


To learn the major features of custom report
-
building, this document will walk you through a series of projects using Crystal Reports to
build the custom reports.


Project One
-

Modifying an Existing Report’s Logo and Title



User Level:

Begin
ner (Must know basic Windows skills, double
-
clicking a mouse, navigating

through the Windows menu system in a “File
-

Open” box. No Crystal Reports

pre
-
training necessary).


Amount of Time: 15


30 minutes



Pre
-
Requisites:

Crystal Reports 8.5 installed

on PC





A sample report from the application





A bitmap of the logo to change on the report (either Bitmap, TIFF or JPEG format).


Project Two
-

Modifying an Existing Report’s Fields

User Level:

Intermediate (Must know basic Windows skills and have a
passing familiarity with

Crystal Reports.).


Amount of Time: 1 Hour



Pre
-
Requisites:

Crystal Reports 8.5 installed on PC





A sample report from the application





A database file (“data.mdb”) associated with the report





A report file (“report.ttx”)

associated with the report

Customizing Crystal Reports



v1.1

Page
3

of
37


Project One
-

Modifying an Existing Report’s Logo and Title


In this project, you will use Crystal Reports to change the Title and Logo of a report. To do this, you will need a bitmap o
r a scanned
picture of the logo you want

to add.


Project Steps

1.

Start Crystal Reports

2.

Open the form you wish to modify

3.

Change the Logo

4.

Save The Report As A New Report

5.

Change The Title

6.

Close Crystal Reports


The following pages contain a detailed explanation of each of these steps.


Start Crystal

Reports


Regardless of the version of Crystal Reports you use, it requires a lot of
real estate

on the desktop. Generally, you should minimize or
close all other windows on the desktop before starting Crystal Reports. This will make it easier to work wi
th the Crystal Report windows.
Perform the following steps:


1.

Click the Start button on the taskbar and then point to Programs on the Start menu. Point to Crystal Reports Tools on the
Programs submenu, and then point to Crystal Reports.

The default menu
structure for Crystal Reports 8.5 is shown below.
Your system may have a different set of menus:




Customizing Crystal Reports



v1.1

Page
4

of
37


2.

Click Crystal Reports, click on “Open an Existing Report” and double
-
click on the words “More Files…”.
The “Welcome to
Crystal Reports” dialog box disp
lays. Again, your screen may appear differently, depending on whether this is the first time you’ve
used Crystal Reports, etc.


Customizing Crystal Reports



v1.1

Page
5

of
37


Open the form you wish to modify


3.

Navigate to the “Reports” subdirectory under the Application directory. Click on any repo
rt there you wish to change and
click the “Open” button.

Usually, this will be under the application name in the C:
\
Program Files directory. Your screen will
probably have a lot more reports with different titles, but this procedure should work for any of

them. For this example, we’ll click on
the “Report by Facility & Department” report.




Customizing Crystal Reports



v1.1

Page
6

of
37


4.

Once Crystal Reports has opened the report (it can take a little while),
click on the Design tab
. You’ll see something like the
following. Note that in the Page
Header section, there is a field called the “?Custom Title” field. Also, that in the Page Footer
section, there’s a “?Filter” field. Don’t change or modify these (except to move them)!! These fields (and any field that s
tarts with a
question mark) must
be in the report or the application will generate an error!




Customizing Crystal Reports



v1.1

Page
7

of
37


Change the Logo


5.

First, let’s get rid of that awful logo and replace it with our own. To do this,
click once on the logo
. Note that Crystal Reports will
place a border around it, with litt
le squares on the corner and sides. These are called “sizing handles”. You could resize the logo by
clicking on the squares and without releasing, drag the picture’s logo to the size you want and release the mouse button. Dr
agging
a corner of the logo m
oves the two adjacent borders at the same time.




6.

Once you’ve selected the picture,
delete it by pressing the “Delete” key
. That’s it, it’s gone. Now, let’s go get your “much better
looking” icon. To do this,
select “Insert”, “Picture from the main me
nu
, as shown.



Customizing Crystal Reports



v1.1

Page
8

of
37


7.

The Open screen appears.
Navigate to the subdirectory containing the input file. Click on the file with the bitmap you’d like
to use and choose “Open”
. For this example, we’ll choose the “My Icon.bmp” file.



Customizing Crystal Reports



v1.1

Page
9

of
37


8.

Note that the program
copied the new logo into the Report Header section. This would be perfect, except that we want it on every
page and the Report Header section is greyed
-
out (which means it won’t show on the report). Let’s move it to the Page Header
section. To do this,
put the cursor over the picture, press and hold the left mouse button and drag the picture down to the
Page header section. Then, let go of the mouse button.



Customizing Crystal Reports



v1.1

Page
10

of
37


9.

The report should now look like this.



Customizing Crystal Reports



v1.1

Page
11

of
37


Save The Report As A New Report


10.

Now, let’s save

the work so far.
Select “File”, “Save As …” from the main menu
.




11.

Type in a new name for the report and press the “Save” button.

When you save a Crystal Report, they are saved as a file with
extension
.rpt
. The application will show the name you gi
ve the file.


Customizing Crystal Reports



v1.1

Page
12

of
37


Change The Title


12.

After saving, the program takes you back to the Design screen. Now that you’ve customized the logo, let’s put the facility n
ame in
the title. To do this,
double
-
click twice on the “Report by Facility & Department” lab
el in the Page header
. The words will
change shape slightly, a box will appear around the words and the cursor will be blinking at the beginning of the words.




13.

Type the name of your Hospital or business, followed by a space, a dash and another space. T
hen, save the report by
clicking “File”, “Save” from the main menu.

Customizing Crystal Reports



v1.1

Page
13

of
37


Close Crystal Reports


14.

Similar to other Windows applications, you can minimize Crystal Reports to work with another application temporarily, such as

a
spreadsheet or word
-
processing doc
ument. You can then return by clicking on the Crystal Report button on the taskbar. When you
have completed working within Crystal Reports,
click on the Crystal Reports Close button in the upper right
-
hand corner
.




15.

If you’ve made changes to the repo
rt since the last time it was saved, Crystal Reports displays the “Save Changes” dialog box. If
you click the “Yes” button the report will be saved and the application ends. If you click the No button, you will quit with
out saving
the changes. Clicking
the Cancel button will close the dialog box.


That’s it. If you like, repeat this process with the rest of the reports.


Project Summary


Project 1 introduced the basic skills necessary to use Crystal Reports. You learned how to start Crystal Reports,

open an existing
report, modify both graphic and text
-
based fields, resize a field, save the report as a new report and how to quit Crystal Reports.


What You Should Remember




Don’t change or modify fields that start with a question mark.



Always save modi
fied reports under a new name.


Customizing Crystal Reports



v1.1

Page
14

of
37



Project Two


Modifying an Existing Report’s Fields


In Project One, you learned how to open, modify and save a Crystal Report. In this project, you will use Crystal Reports to
change the
name of a field on the body of t
he report. To do this, you will need a database and a “report.ttx” file associated with the report.


Project Steps

1.

Start Crystal Reports & Open the form you wish to modify

2.

Set the data location to the database

3.

Create a New Report by Deleting Group Fields

4.

Create a New Report by Changing Group Fields

5.

Set the data location to the “Report.ttx” file for each new report.


The following pages contain a detailed explanation of each of these steps.


Start Crystal Reports & Open the form you wish to modify


1.

Start C
rystal Reports and open the “Report by Facility & Department” report

as described in Project One (Note: it doesn’t
matter whether you want to open the original or the report you modified. The procedure’s the same). The Crystal Reports scr
een
will then sh
ow the report.
Click on the “Design” tab.


Set the data location to the database


2.

Let’s first make it easy to see the results of any changes we make. Each report can be connected to either a database or to
a
“Report.ttx” file. If it’s connected directly
to a database, we will be able to see the effect of any changes we make in Crystal Reports
by clicking on the “Preview” tab. However, the application talks to the report through the “Report.ttx” file, so when we sav
e it, we
need to tell the Report to use
the “Report.ttx” file to connect to the database. If you don’t do this, when the report runs from within
the application, every record will be shown, regardless of whatever data you chose in the application.


To change the location from the “Report.ttx” f
ile to the database,
choose “Database”, “Set Location” from the main menu
.


Customizing Crystal Reports



v1.1

Page
15

of
37


Customizing Crystal Reports



v1.1

Page
16

of
37


3.

The following screen appears. Notice that the Location Table is currently set to “Report.ttx”. To modify this
, click on the “Set
Location…” button.



4.

The Data Explorer scree
n will appear.
Click on the “+” sign to the left of the “More Data Sources” selection.


Customizing Crystal Reports



v1.1

Page
17

of
37


Customizing Crystal Reports



v1.1

Page
18

of
37

5.

OK, we’re getting there. As you can see, there’s a large number of “data sources” you can connect to. The one we want is und
er
the “Active Data” selection.
Click
on the “+” sign to the left of the “Active Data” selection.



6.

Click on the “+” sign to the left of the “Active Data (ADO)” selection.



Customizing Crystal Reports



v1.1

Page
19

of
37


7.

Ah, good, more screens. Now we want to select the type of connection we plan to use. To do this,
Choose the “ADO a
nd OLE
DB” option and press the “Build…” button.



Customizing Crystal Reports



v1.1

Page
20

of
37


8.

And again, a very impressive list to choose from. Oh well, with power comes responsibility.
Choose the “Microsoft Jet 4.0 OLE
DB Provider” choice and press the “Next >>” button.




Customizing Crystal Reports



v1.1

Page
21

of
37


9.

What, you’re sti
ll here (just kidding)? On the “Data Link Properties” screen,
click the “…” button below and to the right of where
it says “Select or enter a database name”.



10.

In this window, locate the data file used by the report. It is usually called “data.mdb” and
usually located one subdirectory up from
the Reports subdirectory.
Select the “data.mdb” file and press the “Open” button.



Customizing Crystal Reports



v1.1

Page
22

of
37


11.

Ok, we’re back to the “Data Link Properties” screen. Just to make sure we’ve got a good connection,
click on the “Test
Connect
ion” button in the bottom right hand corner
. If everything’s OK, a “Test Connection succeeded” window appears.
Click “OK” on the window and click “OK” on the “Data Link Properties” screen
.



12.

Click “OK” on the “Select Data Source” screen.


Customizing Crystal Reports



v1.1

Page
23

of
37


Customizing Crystal Reports



v1.1

Page
24

of
37


13.

Make sure
that the word “ado” is highlighted under Active Data (ADO) (as shown below) and
click on the “Set” button
.



14.

We’re back at the “Set Location” screen. Make sure that “ado” is in the table field at the bottom of the screen and
click on the
“Done” button
.


Customizing Crystal Reports



v1.1

Page
25

of
37


Customizing Crystal Reports



v1.1

Page
26

of
37

15.

Now we need to choose a table within the database. Make sure that the “Pick from a list of Database Objects” option is chose
n and
that the word “Data” is in the “Object” field. Then,
press the “OK” button to go back to the Report screen
.



OK, we’re
done. But why did we do all this? Well, if you now click on the “Preview” tab you will see the report with data in it just
as if it
were created from within the program. Though this procedure is long, it’s highly recommended so that you can see your res
ults as you
work. Just be sure to reset it back before you save the report (more on that procedure later).


Customizing Crystal Reports



v1.1

Page
27

of
37





Customizing Crystal Reports



v1.1

Page
28

of
37


Deleting Group Fields



OK, let’s have some fun. The database we just connected to contains a list of how many items are in each department

and entity.




Currently the report shows the quantity of a group of items by Entity and Department, like so:


-

Entity

-

Department

-

Item # and Quantity of each item


Just for fun, let’s first change the report to view the number of items in each depar
tment, regardless of what entity it’s in, like this:


-

Department

-

Item # and Quantity of each item


Customizing Crystal Reports



v1.1

Page
29

of
37

1.

To do this first
save the document with the title “Report by Department”

(see project 1 for the procedure to do this).


2.

Then,
click on the “Design” tab
of the main window

(if you’re not already there).


3.

The database entries that are used to group data (ex: Department, Entity) are known as a “group”. To delete the “Entity” gr
oup,
right
-
click on “Group Header #1” and choose “Delete Group from the menu
, as

shown.



4.

Crystal Reports makes sure you want to do this step by asking the following.
Press the “Yes” button
.




5.

Now
change the Title of the report from “My Hospital
-

Report by Entity & Department” to “My Hospital
-

Report by
Department”

(see project 1

for the procedure to do this).


6.

Finally,
decrease the size of the “Report header” field
. Point to the field’s lower border (the icon will turn into two parallel lines).
Without releasing the mouse button, drag the bottom border all the way to the top of

the border, as shown.
Do the same with the
Report footer.


Customizing Crystal Reports



v1.1

Page
30

of
37





The “Design” view of the report should now look like this:




7.

Click on the “Preview” tab

to review the results of your change:


Customizing Crystal Reports



v1.1

Page
31

of
37


8.

Now
click “File” & “Save” from the main menu
. A new window

pops up.
Press “Yes”
on this window.



Changing Group Fields


Now, let’s create a report from this report that lists the items by entity like this:


-

Entity

-

Item # and Quantity of each item


To do this, we’re going to change the Department group to the

Entity group. The first couple of steps you should be familiar with
-



1.

First,
save the current report as “Report by Entity”
.


2.

Then,
click on the “Design” tab of the main window

(if you’re not already there).


3.

To change the “Department” group,
right
-
clic
k on “Group Header #1” and choose “Change Group” from the menu
.




Customizing Crystal Reports



v1.1

Page
32

of
37

4.

This window now appears.
Left
-
click on the down
-
arrow box to the right of the “Department” field and choose “Entity”.
Then select “OK”
.




5.

Now, we need to change the fields in this grou
p.
Change the “Dept # “ field to read “Entity #”

(the same way you changed the
title).


6.

Now,
left
-
click on the Department field and press the “Delete” key
. Then
select “Insert”, “Field Object”
from the main menu.


Customizing Crystal Reports



v1.1

Page
33

of
37


The following window will pop up. This
is a very powerful window (you’ll be here a lot as you get more advanced). Using this window,
you can add the following types of fields to the report:




Database fields
-

all the fields in the database. This is the field category you’ll use most.



Formula
Fields


custom fields you create to perform very powerful custom formatting (ex.: print “No Entry” if the Quantity is blank,
etc.).



Parameter fields
-

used to pass information from the application to the report (you’ve already been introduced to two of th
em


the
“?Custom Title” and the “?Filter” fields).



“Running Total” fields
-

used to create subtotals of items.



Group Name fields
-

the names of the fields we are grouping


Using these fields is beyond the scope of this document, but their use is highly re
commended. Please consult your I.S. department or
take a Crystal Reports class.



7.

We need Group Name fields for this procedure.
Left
-
click the “+” sign to the left of the Group Name fields
.

Customizing Crystal Reports



v1.1

Page
34

of
37


8.

Drag the “Group #1 Name: ado.Entity” field to the right of th
e word “Entity #”
. You may need to re
-
arrange the fields in this
section to make room.
Close the Field Explorer window by pressing the “Close” button
.



9.

Change the Title of the report from “My Hospital
-

Report by Department” to “My Hospital
-

Report by
Entity”
.


10.

Preview the report by clicking on the “Preview” tab.

It should look similar to this:



11.

Click “File” & “Save” from the main menu
.


Customizing Crystal Reports



v1.1

Page
35

of
37


Set the data location to the “Report.ttx” file for each new report


Well, we created two new reports, but now we

need to set their data location from the database to the “Report.ttx” file. Use the following
procedure on each report.


1.

If the report is not already open,
open the report by choosing “File”, “Open”

from the main menu.


2.

On the main menu,
choose “Database
”, “Set Location”


3.

On the “Set Location” screen, if the table name is not “Report.ttx”,
press the “Set Location” button
.


4.

On the Data Explorer screen,
select the “+” sign next to “More Data Sources”. Select the “+” sign next to “Active Data”.
Select the
“+” sign next to “Active Data (Field Definitions Only)”.




5.

On the “Select Data Source” screen, make sure the “Data Definition” option is selected and press the “Browse” button.


6.

In the “Reports” folder, select the “Report.ttx” file and press the “Open” b
utton.


7.

On the “Select Data Source” screen, press the “OK” button.


Customizing Crystal Reports



v1.1

Page
36

of
37


8.

On the Data Explorer screen, make sure the “Report.ttx” field is selected and
press the “Set” button
.



9.

On the “Set Location” screen, make sure the table name is now “Report.ttx” and

pr
ess the “Done” button.
If a new window pops
up telling you it’s “proceeding to fix up the report, press the “OK” button.


10.

Click “File” & “Save” from the main menu
.


You’ve completed this procedure. Don’t forget to do the other report you created as well.



Project Summary


Project 2 introduced some moderate
-
level skills necessary to use Crystal Reports. You learned how to set the data location for a
reports, modify and delete group fields and were introduced to different field types in the “Field Explor
er”.


What You Should Remember




If you set the data location to the database, don’t forget to set it back to the “report.ttx” file when you’re done making ch
anges.









Customizing Crystal Reports



v1.1

Page
37

of
37


Project Three


Adding a Group to an Existing Report


Project Four


Creating a Ne
w Crystal Report