no stress tech guide to crystal reports xi: for · pdf fileno stress tech guide to crystal...

12
No Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy

Upload: duonghanh

Post on 30-Jan-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: No Stress Tech Guide To Crystal Reports XI: For · PDF fileNo Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy . Published By: Tolana Publishing PO Box

No Stress Tech Guide To

Crystal Reports XI: For Beginners

By Dr. Indera E. Murphy

Page 2: No Stress Tech Guide To Crystal Reports XI: For · PDF fileNo Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy . Published By: Tolana Publishing PO Box

Published By: Tolana Publishing PO Box 719 Teaneck, NJ 07666 USA Find us online at www.tolana.com Inquiries may be sent to the publisher: [email protected] Our books are available online at amazon.com, www.lulu.com/tolanapub and www.barnesandnoble.com Copyright © 2006 Dr. Indera E. Murphy All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, storage in an information retrieval system, or otherwise, without prior written permission from the publisher. ISBN-10 0-9773912-3-X ISBN-13 978-0-9773912-3-3 Library of Congress Control Number: 2006904826 Printed and bound in the United States Of America Notice of Liability Every effort has been made to ensure that this book contains accurate and current information. However, the publisher and author shall not be liable to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly, as a result of any information contained herein or by the computer software and hardware products described in it. Trademarks All companies and product names are trademarks or registered trademarks of their respective companies. They are used in this book in an editorial fashion only. No use of any trademark is intended to convey endorsement or other affiliation with this book. Cover designed by Mary Kramer, Milkweed Graphics, www.milkweedgraphics.com

Discount On Future Books To be notified when new titles are released, send an email with the subject

"New Book Release". This will entitle you to a pre-publish discount, for new titles that are released.

Page 3: No Stress Tech Guide To Crystal Reports XI: For · PDF fileNo Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy . Published By: Tolana Publishing PO Box

. . . . . . . . . . . . . . . . . . . . . . © 2006 Tolana Publishing 2-1

CREATE YOUR FIRST REPORT

In addition to creating your first report, after completing the exercises in this lesson, you will be able to:

Have a foundation of database terminology Understand data types Have a foundation of Crystal Reports terminology Understand the report design process Understand the sections of a report Understand the report creation options Understand the save data report options Organize reports in the Workbench Use the Group Tree Use the Design and Preview windows

To pass the RDCR201 exam, you need to be familiar with and be able to:

Understand database concepts Plan the layout and select content for a report Develop a report prototype Know the purpose of each section in a report Understand the design environment, including menus and

the design and preview windows Connect to a data source Preview reports Save reports

LESSON

2

Page 4: No Stress Tech Guide To Crystal Reports XI: For · PDF fileNo Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy . Published By: Tolana Publishing PO Box

Create Your First Report

. . . . . . . . . . . . . . . . . . . . . . 2-24 © 2006 Tolana Publishing

Earlier in this lesson you viewed two of the reports that come with the Xtreme sample database. The reason that you were able to view data for these reports is because the reports were saved with the data. You will learn more about saving data with reports later in this lesson. If the data is not saved with the report, you would have to create a connection to the database(s) that the report gets its data from, to view data with the report.

If you want to create a new report or modify an existing report that does not have the data saved with it.

Step 1: Create A Connection To The Data Source There are several types of data sources that you can use in Crystal Reports. Figure 2-20 shows the categories of connection options that are available. Table 2-5 explains some of the more popular connection options.

You may see different data source options depending on the data components that were selected when you installed Crystal Reports. You will also see data source options that you have added.

Figure 2-20 Available connection options illustrated

If you do not see the UNIVERSES data source option shown above in Figure 2-20 and you need to use it, you can download the fix from this web page. http://support.businessobjects.com/library/kbase/articles/c2017168.asp

Connection Option Lets You Connect To . . . Access/Excel (DAO) Access databases and Excel files. Database Files Standard PC databases including FoxPro, Paradox, Clipper and dBASE. ODBC (RDO) Any ODBC complaint database including Oracle, Sybase, Access and

Visual FoxPro. OLAP OLAP cubes and .CAR files. OLAP stands for Online Analytical

Processing. CAR stands for Crystal Analysis file. OLE DB (ADO) Data link files that contain connection information that is saved in a file.Universes Business Objects query and analysis tools like Web Intelligence. XML XML files. More Data Sources Databases through ODBC drivers including ACT! 3.0, Btrieve, Informix,

Oracle, Sybase and Web/IIS log files. Table 2-5 Database and data sources explained

Page 5: No Stress Tech Guide To Crystal Reports XI: For · PDF fileNo Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy . Published By: Tolana Publishing PO Box

Lesson 2

. . . . . . . . . . . . . . . . . . . . . . © 2006 Tolana Publishing 2-25

If you haven't created a connection (either for the Access/Excel (DAO) or the ODBC (RDO) connection type) for the Microsoft Access Xtreme sample database that comes with Crystal Reports, you will have to do that first. Follow the steps below to create an Access/Excel (DAO) connection. When Crystal Reports is installed, an ODBC connection for the Xtreme database should have been created. You can go to the section, Step 2: Select The Tables, if you already have a connection to the Xtreme database.

How To Create An Access/Excel (DAO) Connection 1. Click on the STANDARD REPORT WIZARD link on the Start Page.

2. Click on the plus sign in front of the CREATE NEW CONNECTION Data Source option. If this is the first

Access/Excel (DAO) connection that you are creating, you will see the Access/Excel (DAO) connection dialog box.

3. Click on the button at the end of the DATABASE NAME field. Navigate to the following path: C:\Program Files\Business Objects\Crystal Reports 11\Samples\en\Databases, as shown in Figure 2-21. If you changed the default folders during the installation, navigate to the destination folder that you selected in Lesson 1 in Figure 1-7.

Figure 2-21 Path to the Xtreme sample database

4. Double-click on the XTREME.MDB database file. The database should have been added to the Database Name field on the dialog box as shown in Figure 2-22.

Figure 2-22 Xtreme sample database added to the Connection dialog box

Page 6: No Stress Tech Guide To Crystal Reports XI: For · PDF fileNo Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy . Published By: Tolana Publishing PO Box

Create Your First Report

. . . . . . . . . . . . . . . . . . . . . . 2-26 © 2006 Tolana Publishing

If you want to make sure that you added the correct database, click in the Database Name field and press the END key. You will be able to see the database name shown above in Figure 2-22.

If the database required logon information, you would check the SECURE LOGON option shown above in Figure 2-22. The remaining fields on the dialog box would become available for you to enter the password information.

5. Click the FINISH button. You have completed creating your first connection to a database in Crystal Reports. That wasn't so bad, was it?

Step 2: Select The Tables 1. Click on the plus sign in front of the CREATE NEW CONNECTION folder, then click on the plus sign in

front of the Access/Excel (DAO) folder or the ODBC folder depending on the connection type that you created for the Xtreme database.

2. Select the Xtreme database and click on the plus sign in front of the Tables folder. You should see the tables shown in Figure 2-23. These are all of the tables that are in the Xtreme database. They are the tables that are used in the sample reports that you viewed earlier in this lesson.

Figure 2-23 Tables in the Xtreme database

The only reason that I can think of to click the CANCEL button shown above in Figure 2-23 on a screen in the wizard is if you decide that you no longer want to create the report. You will lose all of the options that you have selected if you click the Cancel button. It is better to use the BACK button to go back and make correct changes, because you cannot reopen the wizard to make changes or pick up where you left off.

3. Click on the PRODUCT table, then click the > button. The Product table should now be in the SELECTED TABLES section, as shown in Figure 2-24. Click Next.

Page 7: No Stress Tech Guide To Crystal Reports XI: For · PDF fileNo Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy . Published By: Tolana Publishing PO Box

Lesson 2

. . . . . . . . . . . . . . . . . . . . . . © 2006 Tolana Publishing 2-27

Figure 2-24 Product table selected

All of the items in the AVAILABLE FIELDS section are the fields that are in the Product table that you selected on the previous screen.

View The Data In A Field The BROWSE DATA button on the Fields screen will let you view data that is in the field that you select. Being able to view the data in a field is helpful if you are not familiar with the data in a table. This button is on several dialog boxes in Crystal Reports.

1. Click on the PRODUCT NAME field, then click the BROWSE DATA button. You will see the dialog box shown in Figure 2-25. The items in the scroll box is the data in the Product Name field.

Figure 2-25 Data in the Product Name field

Notice that the FIELD TYPE and LENGTH are displayed at the top of the dialog box shown above in Figure 2-25. This information is helpful because you can learn more about the field and the data stored in it.

2. Click the Close button when you are finished viewing the data.

You can also view the data on the Design window. By default, the first 500 distinct values in the field are displayed. This default number of values cannot be changed, but the actual values that you see can be changed, by clearing the SELECT DISTINCT DATA FOR BROWSING option on the Database tab on the Options dialog box or on the Report Options dialog box if you only want the change to be for the report that you are currently working on. [See Lesson 8, Report Options] It probably is not a good idea to turn this option off because you will see duplicate data in the Browse Data dialog box shown above in Figure 2-25.

Page 8: No Stress Tech Guide To Crystal Reports XI: For · PDF fileNo Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy . Published By: Tolana Publishing PO Box

Create Your First Report

. . . . . . . . . . . . . . . . . . . . . . 2-28 © 2006 Tolana Publishing

How To Find A Field The FIND FIELD button will let you search for a field in the table. You will see this button on a few dialog boxes in Crystal Reports. I'm not sure that I understand the purpose of this button because all of the fields in a table are displayed on this dialog box. It could be helpful if you don't know which table a field is in. The Find Field button will only find the first field that matches the text that you enter in the dialog box shown in Figure 2-26. You can also enter a partial field name. If the same field name is in more than one table, it does not continue searching. If you were creating a report on your own you would have already written down a list of fields and where they are located in the report design process, because you learned to do this earlier in this lesson <smile>.

Figure 2-26 Enter Search Name dialog box

Step 3: Select The Fields 1. Click on the Product Name field if it is not already selected and click the > button. You should see

the field in the FIELDS TO DISPLAY section.

2. Add the following fields to the Fields To Display section: Size, Price (SRP) and Product Class. Figure 2-27 shows the fields that should have been added. Click Next.

Figure 2-27 Fields selected

You can add several fields at the same time by clicking on the first field that you want to add, then hold down the CTRL key and click on the other fields, one by one, that you want to add. When you have all of the fields selected that you want to add, click the > button.

To add all of the fields in the table at the same time, click the >> button. You do not have to select any fields before clicking this button. To remove a field that you do not need on the report, click on the field in the Fields To Display section, then click the < button.

Page 9: No Stress Tech Guide To Crystal Reports XI: For · PDF fileNo Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy . Published By: Tolana Publishing PO Box

Lesson 2

. . . . . . . . . . . . . . . . . . . . . . © 2006 Tolana Publishing 2-29

To remove all of the fields from the Fields to Display section, click the << button. The order that you add the fields to the Fields to Display section is the order that they will appear on the report in the details section from left to right. If you discover that the fields are not in the order that you want them to appear on the report, click on the field in the Fields To Display section and click the UP or

OWN rrow button illustrated above in Figure 2-27 to move the field to where it should be. D a

The order that the fields are in will change automatically if at least one field is selected to group on. Fields that are grouped on are moved to the beginning of the details section. You can rearrange the fields after the wizard has created the report. This does not happen when you create a report from scratch that has groups.

Notice in Figure 2-27 above, that fields in the Fields To Display section have the table name in front of thfield name. This is done to let you know which table the field is located in. This is helpful when you are using more than one table to create the report. Primary key fields in tables often have the same field name when the tables hav

e

e related information. Without adding the table name, you would not know which table field ame from.

a c

Primary key fields are fields that are used to link one table to another table.

Step 4: Select The Grouping Options As you learned earlier, grouping allows you to organize and sort the data. Grouping data forces all records that are related by the field that is being grouped on, to print together. Grouping data makes reports thahave a lot of data easier to read. Grouping the data in a report is optional. You can group on more than one field. You can group on fields that have already

t

been selected to print on the report, or you can select elds to group on that will not print on the report.

this lesson uses the grouping option. That report is rouped on customer name and contact name.

1.

RDER is correct. Figure 2-28 shows the grouping options that you should have selected. Click Next.

fi The Accessibility report that you viewed earlier in g

Add the Product Class field to the Group By section. The default grouping option IN ASCENDING O

Figure 2-28 Field added to the Group By section

s by, as discussed below. This is how u sort the values that are in the field that is being grouped on.

There are two options that you can select from to group the recordyo

Page 10: No Stress Tech Guide To Crystal Reports XI: For · PDF fileNo Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy . Published By: Tolana Publishing PO Box

Create Your First Report

. . . . . . . . . . . . . . . . . . . . . . 2-30 © 2006 Tolana Publishing

IN ASCENDING ORDER This is the default grouping option. The values in the field being grouped on will be sorted in A-Z order if the field is a string field. If the field being used to group on is numeric, the values will be sorted in 0-9 order. IN DESCENDING ORDER The values in the field being grouped on will be sorted in Z-A order if the field is a string field. If the field being used to group on is numeric, the values will be sorted in 9-0 order.

Step 5: Select The Summary Options Creating summary fields is optional. Summary options usually involve calculated fields. By default, the wizard will create a summary field for all numeric fields that were selected to print on the report. There are 25 built-in summary functions that you can use. Many of them are shown at the bottom of Figure 2-29. The number of summary options that you see in the list, depends on the data type of the field that you are summarizing on. Not all data types can use all of the summary function options. Many of the summary functions are only for numeric fields.

Figure 2-29 Summary options illustrated

1. Add the Product Class field to the SUMMARIZED FIELDS section.

2. Open the drop down list shown above in Figure 2-29 and select COUNT. Notice that the Product Class field has different options in the drop down list, then those shown above for the Product Price (SRP) field. Figure 2-30 shows the summary options that should be selected. Click Next.

Page 11: No Stress Tech Guide To Crystal Reports XI: For · PDF fileNo Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy . Published By: Tolana Publishing PO Box

Lesson 2

. . . . . . . . . . . . . . . . . . . . . . © 2006 Tolana Publishing 2-31

Figure 2-30 Summary options

3. Select the TOP 5 GROUPS option. Figure 2-31 shows the Group Sorting options that should be selected. Click Next.

Figure 2-31 Group Sorting options

The Top 5 Groups option will only display data for the five groups that have the highest value in the field selected in the SUMMARY VALUES field. Selecting NONE, which is the default, will display all groups. It is possible that you will not get the five groups that you think should appear on the report. This is because of the way that Crystal Reports processes data. In Lesson 7 you will create a Top 5 group report that illustrates unexpected results because a wizard was used to create the report.

Step 6: Select The Chart Type Adding a chart to a report is optional. Once you select a chart type, the wizard will fill in information for the other fields on the dialog box. If you are not sure what options to select, accept the defaults, preview the report and then decide which chart options need to be modified.

1. Select the PIE CHART option. Figure 2-32 shows the chart options that should be selected. Click Next.

Page 12: No Stress Tech Guide To Crystal Reports XI: For · PDF fileNo Stress Tech Guide To Crystal Reports XI: For Beginners By Dr. Indera E. Murphy . Published By: Tolana Publishing PO Box

Create Your First Report

. . . . . . . . . . . . . . . . . . . . . . 2-32 © 2006 Tolana Publishing

Figure 2-32 Chart options

Step 7: Select The Fields To Filter On Creating filters is optional. Filters are another way that you can narrow down the number of records that will appear on the report. You can create as many filters as you need. In this step you will create a filter for the Product Size field to only display records that have a size, that is in a specific range.

1. Add the Product Size field to the FILTER FIELDS section, then open the drop down list and select IS BETWEEN.

2. Open the next drop down list and select 16, then open the last drop down list and select XLRG. Figure 2-33 shows the filter options that should be selected. Click Next.

The data in the last two drop down lists is the actual data in the field that you are creating the filter for.

The filter that you just created will only display products that have a size that is between 16 and XLRG. The filter options shown in Figure 2-33 are the same as what you would select on the SELECT EXPERT tool that you will learn how to use in Lesson 5.

Figure 2-33 Filter options