300
Crystal Reports 2008: Report Design I - Fundamentals of Report Design Learner’s Guide BOC310

BOC310 en Col91 FV Part Ltr Marca

  • Upload
    alisg77

  • View
    249

  • Download
    20

Embed Size (px)

Citation preview

Page 1: BOC310 en Col91 FV Part Ltr Marca

Crystal Reports 2008: Report Design I -Fundamentals of Report Design

Learner’s GuideBOC310

Page 2: BOC310 en Col91 FV Part Ltr Marca

Copyright© 2009 SAP® BusinessObjects™. All rights reserved. SAPBusinessObjects owns the followingUnited States patents,whichmay cover products that are offered and licensed by SAPBusinessObjects and/or affliated companies: 5,295,243; 5,339,390;5,555,403; 5,590,250; 5,619,632; 5,632,009; 5,857,205; 5,880,742;5,883,635; 6,085,202; 6,108,698; 6,247,008; 6,289,352; 6,300,957;6,377,259; 6,490,593; 6,578,027; 6,581,068; 6,628,312; 6,654,761;6,768,986; 6,772,409; 6,831,668; 6,882,998; 6,892,189; 6,901,555;7,089,238; 7,107,266; 7,139,766; 7,178,099; 7,181,435; 7,181,440;7,194,465; 7,222,130; 7,299,419; 7,320,122 and 7,356,779. SAPBusinessObjects and its logos, BusinessObjects, Crystal Reports®,Rapid Mart™, Data Insight™, Desktop Intelligence™, RapidMarts®, Watchlist Security™, Web Intelligence®, and Xcelsius®are trademarks or registered trademarks of Business Objects,an SAP company and/or affiliated companies in the UnitedStates and/or other countries. SAP® is a registered trademarkof SAPAG inGermany and/or other countries. All other namesmentioned hereinmay be trademarks of their respective owners.

Page 3: BOC310 en Col91 FV Part Ltr Marca

C O N T E N T S

About this CourseCourse introduction...................................................................................................xiiiCourse description.....................................................................................................xivCourse audience.........................................................................................................xivPrerequisites................................................................................................................xivAdditional education.................................................................................................xivLevel, delivery, and duration...................................................................................xivApplicable certifications and designations.............................................................xivCourse success factors ................................................................................................xvCourse setup ................................................................................................................xvCourse materials .........................................................................................................xvLearning process ........................................................................................................xvi

Lesson 1Planning a ReportLesson introduction ......................................................................................................1Defining database concepts .........................................................................................2

Database terms and definitions ...........................................................................2Planning and developing a report prototype............................................................3

Report prototype layouts......................................................................................3Developing a report prototype.............................................................................3Report Requirements Checklist............................................................................3Activity: Developing a report prototype............................................................4

Debrief: Planning a report ...........................................................................................8Lesson summary ...........................................................................................................9

Lesson 2Creating a ReportLesson introduction.....................................................................................................11Creating a report..........................................................................................................12

Report creation methods ....................................................................................12Specifying the data source .................................................................................13

Adding tables...............................................................................................................18Adding tables to a report....................................................................................18Linking database tables ......................................................................................19

The design environment.............................................................................................21

iiiTable of Contents—Learner’s Guide

Page 4: BOC310 en Col91 FV Part Ltr Marca

Understanding the Design window .................................................................21Working with toolbars in the Design window ...............................................23

Inserting objects on a report.......................................................................................25Working with the Field Explorer.......................................................................25Working with the Report Explorer....................................................................27Working with the Repository Explorer.............................................................30Working with the Workbench............................................................................33Determining data field types .............................................................................35

Previewing a report ....................................................................................................37Previewing reports ..............................................................................................37Viewing a report ..................................................................................................38Working in the Design and Preview tabs ........................................................40

Saving a report ............................................................................................................42Adding summary information ..........................................................................42Saving a report .....................................................................................................43Saving a preview of a report ..............................................................................44Checking a report for errors ..............................................................................45Activity: Creating a report..................................................................................47

Positioning and sizing objects ...................................................................................49Positioning objects using a grid ........................................................................49Positioning objects using guidelines ................................................................51Positioning objects using free-form placement ...............................................53Locking an object’s position and size ...............................................................53Moving objects .....................................................................................................53Aligning objects ...................................................................................................56Resizing objects ....................................................................................................56Cutting, copying, and pasting objects ..............................................................57

Formatting objects ......................................................................................................58Formatting fields using the Formatting toolbar .............................................58Formatting fields using the Format Editor.......................................................58Locking an object’s format .................................................................................63Using text objects .................................................................................................63Activity: Positioning, sizing, and formatting objects......................................65

Quiz: Creating a report ..............................................................................................67Lesson summary .........................................................................................................68

Lesson 3Selecting RecordsLesson introduction.....................................................................................................69Defining the Select Expert .........................................................................................70

Using the Select Expert........................................................................................70The Select Expert’s features ...............................................................................71

Determining the criteria for record selection...........................................................72Defining record selection ...................................................................................72Changing record selection to be case insensitive ............................................74

Fundamentals of Report Design—Learner’s Guideiv

Page 5: BOC310 en Col91 FV Part Ltr Marca

Understanding saved and refreshed data ...............................................................76Saving data with a report....................................................................................76Refreshing data in a report.................................................................................76

Applying record selection..........................................................................................78Setting selection criteria ......................................................................................78Activity: Applying record selection...................................................................79

Setting additional criteria ..........................................................................................80Setting additional record selection criteria ......................................................80Activity: Setting additional selection criteria...................................................81

Modifying record selection ........................................................................................82Modifying existing record selection .................................................................82Modifying a record selection formula ..............................................................82Activity: Refining the record selection..............................................................86

Applying time-based record selection .....................................................................88Setting record selection based on a date ..........................................................88Activity: Applying a time-based record selection...........................................89

Quiz: Selecting records ...............................................................................................91Lesson summary .........................................................................................................92

Lesson 4Organizing Data on a ReportLesson introduction.....................................................................................................93Sorting records ............................................................................................................94

Applying a sort order to records .......................................................................94Using sort controls...............................................................................................95Activity: Applying sorting options....................................................................97

Grouping records ........................................................................................................99Creating groups ...................................................................................................99Navigating using the Preview Panel.................................................................99Navigating in the report using drill-down ....................................................100Applying sort order options when grouping ................................................100Modifying groups .............................................................................................103Changing the definition of a group ................................................................103Deleting groups .................................................................................................104Activity: Creating and modifying groups......................................................105Creating nested and multiple groups ............................................................106Reordering groups ............................................................................................107Activity: Creating and reordering multiple groups......................................108Adding a specified order group ......................................................................109Activity: Adding a specified order group......................................................112Grouping on time-based data ..........................................................................113Activity: Grouping on a date field...................................................................114

Summarizing data .....................................................................................................116Inserting a summary .........................................................................................116Inserting a group and summary at the same time .......................................118

vTable of Contents—Learner’s Guide

Page 6: BOC310 en Col91 FV Part Ltr Marca

Activity: Inserting summaries..........................................................................120Creating a group selection based on summary data ....................................121Activity: Grouping on summary data.............................................................123Creating a grand total .......................................................................................123Activity: Inserting a grand total.......................................................................124

Quiz: Organizing data on a report .........................................................................126Lesson summary .......................................................................................................127

Lesson 5Formatting a ReportLesson introduction...................................................................................................129Adding graphical elements......................................................................................130

Adding a line to a report ..................................................................................130Adding a box to a report ..................................................................................132Adding a graphic to a report ...........................................................................133Adding a dynamic image object .....................................................................135Activity: Adding graphical elements..............................................................136

Combining text objects with database fields ........................................................140Embedding a database field into a text object ...............................................140Preventing truncation of text objects ..............................................................141Formatting individual elements of text objects .............................................142Setting tabs in a text object ...............................................................................143

Applying specialized formatting ............................................................................145Formatting multiple objects .............................................................................145Applying predefined templates.......................................................................146Applying text rotation.......................................................................................148Applying accounting conventions ..................................................................149Applying numeric, currency, date, time, and date/time formatting.........151Activity: Applying formatting elements.........................................................157

Inserting fields with pre-built functions ................................................................159Inserting special fields ......................................................................................159Formatting special fields ..................................................................................161Embedding a special field into a text object ..................................................162Activity: Adding special fields.........................................................................162Debrief: Validating the report design..............................................................164

Quiz: Formatting a report ........................................................................................166Lesson summary .......................................................................................................167

Lesson 6Applying Section FormattingLesson introduction...................................................................................................169Formatting sections...................................................................................................170

Defining the Section Expert..............................................................................170Exploring the Common tab ......................................................................170

Fundamentals of Report Design—Learner’s Guidevi

Page 7: BOC310 en Col91 FV Part Ltr Marca

Exploring the Paging tab...........................................................................173Exploring the Color tab..............................................................................175Exploring the Layout tab...........................................................................176

Formatting a section ..........................................................................................177Activity: Formatting sections............................................................................179

Creating summary reports.......................................................................................180Defining a summary report .............................................................................180Creating a summary report .............................................................................180Viewing the summary report in the Preview window ................................181Activity: Creating a summary report..............................................................181

Quiz: Applying section formatting ........................................................................183

Lesson 7Creating Basic FormulasLesson introduction ..................................................................................................185Defining a formula and its purpose........................................................................186

Formulas .............................................................................................................186The components of a formula...........................................................................186Crystal syntax.....................................................................................................188Special characters used in Crystal syntax.......................................................189Data types ...........................................................................................................189Working with formulas in the Field Explorer................................................190Deleting a formula ............................................................................................191

Creating formulas......................................................................................................192Formula creation methods ...............................................................................192Adding comments to a formula ......................................................................192Creating a formula in the Formula Workshop..............................................192Creating a formula in the Formula Editor .....................................................196

Applying Boolean formulas.....................................................................................198Boolean formulas ...............................................................................................198Creating a Boolean formula .............................................................................198Activity: Applying a Boolean formula............................................................201

Applying If-Then-Else formulas..............................................................................202If-Then-Else formulas .......................................................................................202Creating an If-Then-Else formula ...................................................................202Activity: Applying an If-Then-Else formula..................................................202

Applying date calculations.......................................................................................204Date calculation .................................................................................................204Creating a date calculation ..............................................................................204Activity: Applying date calculations...............................................................205

Applying numeric calculations................................................................................207Numeric calculations ........................................................................................207Creating a numeric calculation .......................................................................207Activity: Applying numeric calculations........................................................208

Applying string manipulation.................................................................................210

viiTable of Contents—Learner’s Guide

Page 8: BOC310 en Col91 FV Part Ltr Marca

String manipulation...........................................................................................210Creating string manipulation formulas..........................................................210Activity: Applying string manipulation formulas........................................212

Debrief: Creating basic formulas.............................................................................214

Lesson 8Applying Conditional ReportingLesson introduction...................................................................................................215Determining trends in data......................................................................................216

Using the Highlighting Expert.........................................................................216Conditionally formatting fields using the Highlighting Expert .................216Setting highlighting priorities .........................................................................217Activity: Using the Highlighting Expert.........................................................219

Formatting data conditionally ................................................................................221Conditional formatting .....................................................................................221Applying on or off properties .........................................................................221Applying attribute properties .........................................................................222Applying conditional formatting functions ..................................................223Activity: Formatting data conditionally.........................................................223

Quiz: Applying conditional reporting ...................................................................225Lesson summary........................................................................................................226

Lesson 9Representing Data VisuallyLesson introduction...................................................................................................227Creating a chart .........................................................................................................228

Choosing a chart location and type ................................................................228Inserting a chart using the Chart Expert ........................................................228

Exploring the Type tab ..............................................................................229Exploring the Data tab ..............................................................................232Exploring the Axes tab ..............................................................................233Exploring the Options tab ........................................................................234Exploring the Color Highlight tab ..........................................................235Exploring the Text tab ...............................................................................236

Charting on summary data ..............................................................................237Drilling down on a chart ..................................................................................238Activity: Charting on summary data..............................................................239Charting on details or formula information ..................................................240Activity: Charting on detail information........................................................242Customizing a chart ..........................................................................................243Editing charts in the Chart Options dialog box ............................................243

Exploring the Appearance tab .................................................................244Exploring the Titles tab .............................................................................244Exploring the Data Labels tab ..................................................................245

Fundamentals of Report Design—Learner’s Guideviii

Page 9: BOC310 en Col91 FV Part Ltr Marca

Exploring the Legends tab ........................................................................246Exploring the Gridlines tab ......................................................................246Exploring the Axes tab ..............................................................................247

Using the zooming features with bar and line charts ..................................247Auto-arranging a chart......................................................................................248Activity: Customizing a chart...........................................................................248

Quiz: Representing data visually ...........................................................................250Lesson summary .......................................................................................................251

Lesson 10Distributing a ReportLesson introduction...................................................................................................253Exporting a report .....................................................................................................254

Exporting reports ..............................................................................................254Exporting formats..............................................................................................254Exporting destinations ......................................................................................255Exporting a report to application formats .....................................................256

Exporting a report to Microsoft Excel .....................................................256Exporting a report to Microsoft Word ....................................................256

Saving an export option ...................................................................................257Activity: Exporting a report to Microsoft Excel.............................................258Activity: Exporting a report to Microsoft Word............................................261

Saving to BusinessObjects Enterprise ....................................................................264Viewing requirements in BusinessObjects Enterprise .................................264Saving a report to BusinessObjects Enterprise ..............................................266Activity: Saving a report to BusinessObjects Enterprise..............................269

Quiz: Distributing a report ......................................................................................270Lesson summary .......................................................................................................271

Answer KeyDebrief: Planning a report .......................................................................................275Quiz: Creating a report ............................................................................................276Quiz: Selecting records .............................................................................................277Quiz: Organizing data on a report .........................................................................278Quiz: Formatting a report ........................................................................................279Quiz: Applying section formatting ........................................................................280Quiz: Applying conditional reporting ...................................................................281Quiz: Representing data visually ...........................................................................282Quiz: Distributing a report ......................................................................................283

ixTable of Contents—Learner’s Guide

Page 10: BOC310 en Col91 FV Part Ltr Marca

Fundamentals of Report Design—Learner’s Guidex

Page 11: BOC310 en Col91 FV Part Ltr Marca

A G E N D AFundamentals of Report Design

Introductions, Course Overview...........................................30 minutes

Lesson 1Planning a Report......................................................................30 minutes❒ Defining database concepts❒ Planning and developing a report prototype

Lesson 2Creating a Report..........................................................................1.5 hours❒ Creating a report❒ Adding tables❒ The design environment❒ Inserting objects on a report❒ Previewing a report❒ Saving a report❒ Positioning and sizing objects❒ Formatting objects

Lesson 3Selecting Records........................................................................1.5 hours❒ Defining the Select Expert❒ Determining the criteria for record selection❒ Understanding saved and refreshed data❒ Applying record selection❒ Setting additional criteria❒ Modifying record selection❒ Applying time-based record selection

Lesson 4Organizing Data on a Report.....................................................1.5 hours❒ Sorting records❒ Grouping records❒ Summarizing data

xiAgenda—Learner’s Guide

Page 12: BOC310 en Col91 FV Part Ltr Marca

Lesson 5Formatting a Report...........................................................................1 hour❒ Adding graphical elements❒ Combining text objects with database fields❒ Applying specialized formatting❒ Inserting fields with pre-built functions

Lesson 6Applying Section Formatting..........................................................1 hour❒ Formatting sections❒ Creating summary reports

Lesson 7Creating Basic Formulas...............................................................3 hours❒ Defining a formula and its purpose❒ Creating formulas❒ Applying Boolean formulas❒ Applying If-Then-Else formulas❒ Applying date calculations❒ Applying numeric calculations❒ Applying string manipulation

Lesson 8Applying Conditional Reporting...........................................45 minutes❒ Determining trends in data❒ Formatting data conditionally

Lesson 9Representing Data Visually....................................................45 minutes❒ Creating a chart

Lesson 10Distributing a Report................................................................30 minutes❒ Exporting a report❒ Saving to BusinessObjects Enterprise

Fundamentals of Report Design—Learner’s Guidexii

Page 13: BOC310 en Col91 FV Part Ltr Marca

About this Course

Course introductionThis section explains the conventions used in the course and in this training guide.

xiiiAbout this Course—Learner’s Guide

Page 14: BOC310 en Col91 FV Part Ltr Marca

Course descriptionCrystal Reports 2008® is a powerful, dynamic, actionable reporting solution that helps youdesign, explore, visualize, and deliver reports via the web or embedded in enterpriseapplications. This two-day instructor led classroom course is designed to give youcomprehensive skills and in-depth knowledge to plan and create reports that will help youanalyze and interpret information.

As a business benefit, you will find that this course is an in-depth approach to the entire reportcreation cycle from planning a report prototype to distributing a report.

Course audience

The Report Processing Strategies course builds on knowledge and skills acquired thoughexperience using Crystal Reports or from previous courses.

Prerequisites

To be successful, learners who attend this course should have the following experience:• Windows conventions• Basic database concepts

Additional education

To increase your skill level and knowledge of Crystal Reports, the following courses arerecommended:• Crystal Reports 2008: Report Design II - Business Reporting Solutions• Crystal Reports 2008: Report Design III - Report Processing Strategies

Level, delivery, and duration

This core instructor-led offering is a two-day course.

Applicable certifications and designations

This is a core course for the BusinessObjects Certified Professional - Crystal Reports certificationpath.

Fundamentals of Report Design—Learner’s Guidexiv

Page 15: BOC310 en Col91 FV Part Ltr Marca

Course success factors

Your learning experience will be enhanced by:• Activities that build on the life experiences of the learner.• Discussion that connects the training to real working environments.• Learners and instructor working as a team.• Active participation by all learners.

Course setup

Refer to the setup guide for details on hardware, software, and course-specific requirements.

Course materials

The materials included with the course materials are:• Name card• Learner’s Guide

The Learner’s Guide contains an agenda, learner materials, and practice activities.

The Learner’s Guide is designed to assist students who attend the classroom-based courseand outlines what learners can expect to achieve by participating in this course.

• Evaluation form

At the conclusion of this course, you will receive an electronic feedback form as part of ourevaluation process. Provide feedback on the course content, instructor, and facility. Yourcomments will assist us to improve future courses.

xvAbout this Course—Learner’s Guide

Page 16: BOC310 en Col91 FV Part Ltr Marca

Additional resources include:• Sample files

The sample files can include required files for the course activities and/or supplementalcontent to the training guide.

• OnlineHelp

Retrieve information and find answers to questions using the onlineHelp and/or user’sguide that are included with the product.

Learning process

Learning is an interactive process between the learners and the instructor. By facilitating acooperative environment, the instructor guides the learners through the learning framework.

Introduction

Why am I here? What’s in it for me?

The learners will be clear about what they are getting out of each lesson.

Objectives

How do I achieve the outcome?

The learners will assimilate new concepts and how to apply the ideas presented in the lesson.This step sets the groundwork for practice.

Practice

How do I do it?

The learners will demonstrate their knowledge as well as their hands-on skills through theactivities.

Review

How did I do?

The learners will have an opportunity to review what they have learned during the lesson.Review reinforces why it is important to learn particular concepts or skills.

Summary

Where have I been and where am I going?

The summary acts as a recap of the learning objectives and as a transition to the next section.

Fundamentals of Report Design—Learner’s Guidexvi

Page 17: BOC310 en Col91 FV Part Ltr Marca

Lesson 1Planning a Report

Lesson introductionYou need to understand the basic concepts of report design, so you can plan what informationto include on your report.

After completing this lesson, you will be able to:

• Define database concepts• Plan and develop a report prototype

1Planning a Report—Learner’s Guide

Page 18: BOC310 en Col91 FV Part Ltr Marca

Defining database conceptsYou need to know where your information is stored and in what form before you can workout your reporting requirements.

After completing this unit, you will be able to:

• Define database terms

Database terms and definitions

By understanding basic database concepts, you will be better prepared to understand what’sneeded when planning a report.

DefinitionTerm

A database is a bank of data that provides the information for areport. A database is also referred to as a data source.Database

A table is a container of information that can hold many pieces ofdata, such as records. Tables are stored in databases.Table

In a database, a record is a complete unit of related information. Eachrecord is made up of one or more fields, and each field can hold onepiece of data (known as a value).

Record

A field is the basic building block of a record. A field can be empty(NULL) or contain a value.Field

A relational database contains tables that can be linked together basedon the relationship between the fields in two or more tables.Relational database

A report is an organized presentation of data. A comprehensive,customized, and attractive report can providemanagement with theinformation it needs to run an organization effectively.

Report

A link is a field that is common to two or more tables and that servesas a connecting point between those two tables. Linking means that

Link records are matched up from two or more table(s) and ensures thatall the data in each row ofmultiple tables refers to the same customer(transaction, invoice, and so on) on a report.

Fundamentals of Report Design—Learner’s Guide2

Page 19: BOC310 en Col91 FV Part Ltr Marca

Planning and developing a report prototypeAs a starting point in the report design process, you should outline the information you wantthe report to provide.

After completing this unit, you will be able to:

• Determine the layout and content of a report• Develop a prototype of a report

Report prototype layouts

By taking a systems-oriented approach to reporting and developing a prototype, you willproduce clearer and more readable reports.

Tip: With the paper prototype in hand, you can put your full effort into learning and using theprogram, rather than trying to design and learn at the same time. For more details on the reportplanning process, see the Crystal Reports User’s Guide.

Developing a report prototype

To develop a report prototype, gather the information on which the report will be based. Thisstage of the report planning process, referred to as requirements gathering, consists of thereport designer asking the report requestor a series of targeted questions, sometimes in theform of a checklist.

After determining the outline of the report request, you develop the prototype by:• Sketching the report on a blank piece of paper, usually the size the report will be printed

on.• Filling in a form.

Sketching the report helps if you need to see the report visually; however, a form with all thecategories listed enables you to develop the prototype without missing a section. As well, theform is more professional than a quickly sketched visual and can be used as a sign-off pointin a report request. Having a list of questions (based on the Report Requirements Checklist)can also help to keep you on track.

Note: TheReport Requirements Checklist is based onCrystal Reports terminology.Use this checklistas a starting point for a version specific to your organization’s needs.

Report Requirements Checklist

You can use these guidelines to jumpstart the planning process.• Define the overall purpose of the report.

The purpose statement helps you focus on your primary needs, and it gives the report botha starting point and a goal.

• Define the readers of the report.

3Planning a Report—Learner’s Guide

Page 20: BOC310 en Col91 FV Part Ltr Marca

Plan the report so it includes the information each user is looking for.

• Define the data used in the report.

What type of data source will you need to connect to?

• Determine the report title.

Write out a working title for the report. You may decide to change it later, but at least youwill have a title to use when creating the prototype report.

• Define header and footer identifying information.

Header information typically includes a company logo, a print date, and the title of thereport. Page numbers usually appear in footers.

• Define specific data that should appear in the body of the report.

The body should contain all the data needed to fulfill the statement of purpose you wrotefor the report. It should also contain all of the data needed by the various users that youhave identified.

• Determine if the data is organized into groups.

How? By customer? By date? By hierarchy? Or by other criteria?

• Determine if the data is sorted based on record or group values.

Data can be sorted based on a specific record or on a group.

• Determine if the data exists or if it needs to be calculated.

Some report information can be drawn directly fromdata fields; other informationwill haveto be calculated based on data field values.

• Determine if the report is to contain only specific records or groups.

You can base a report on all records in a given database, or on a limited set of records fromthe database.

• Determine if the data needs to be summarized.

Do youwant to total, average, count, or determine themaximumorminimumvalue includedin all the values in any column on the report? Do you want to include a grand total at thebottom of a selected column?

• Define how to identify key information through formatting options.

What formatting options can be used to highlight key data on a report?

Activity: Developing a report prototype

Objective

• Determine the layout and content for a report and then develop a paper prototype.

Fundamentals of Report Design—Learner’s Guide4

Page 21: BOC310 en Col91 FV Part Ltr Marca

Instructions

Work through the scenario to determine the basic requirements of a report. Read through thescenario and then create a report prototype. You can use the Report Requirements Checklistas an aid in this activity or sketch the report prototype on a piece of paper.

To build a prototype, determine these requirements for the report:• Purpose• Audience• Report title• Database information• Header and footer information• Information to be included in the body of the report• Groups to be set up• Information to be sorted in a specific order• Specific records to be displayed• Calculations or formulas• Summarized data to be included• Formatting to highlight specific information

Scenario

You are a new report designer for the Sales team in a bike manufacturing company called theXtreme Bike Company. Your first assignment is to create a report thatwill display orders placedby each customer of your organization.

The database administrator tells you that the customer information and the order informationare stored in two separate tables in the Xtreme company database. She advises you to use anODBC connection to the database.

The sales manager tells you that the standard is to use the company logo at the top of thereport as well as a title and a print date that’s labeled. He also tells you that a page numberthat’s labeled in the bottom of the report is the corporate standard as well as the copyrightinformation. The main section of the report should contain the customer’s name and city. Aswell, the order information should include the date the order was placed, the amount of theorder, and the order ID number.

For this report, the team needs to see records selected from the country of the USA and for2004 only. The customers and the cities should be sorted alphabetically, starting with “A.”

While the report should display USA as the only country group, the only regional groups theteam needs to see at this time are theWestern Sales Territory and the Eastern Sales Territory.They are not interested in any other specific groups at this time, so you can tag them as“Unassigned Regions.” They also want to see information grouped on the dates that orderswere placedwith the order dates sorted with the most recent information first.

The team also needs to see such summarized data as the number of orders for each order dategroup. Include the subtotal of the order amount for each order date group as well as a reportgrand total for the order amount. As well, include a percentage of the order amount based

5Planning a Report—Learner’s Guide

Page 22: BOC310 en Col91 FV Part Ltr Marca

on eachmonth’s subtotal compared to the grand total. The team also needs to see the numberof unique customers.

To highlight key informationwith specialized formatting options, ensure the order date groupas well as the subtotal and grand total is easily found on the report. Format the columnheadings, so that navigating the report is easier. Use two different font styles for the reporttitle for contrast.

Report Prototype Form

Report Prototype Form

Purpose

Report titleAudience

Database information

FooterHeader

Body of report

Groups

Record selectionSorting

Calculations or formulas

Fundamentals of Report Design—Learner’s Guide6

Page 23: BOC310 en Col91 FV Part Ltr Marca

Report Prototype Form

Summarized data

Key information/Formatting

Signoff:

7Planning a Report—Learner’s Guide

Page 24: BOC310 en Col91 FV Part Ltr Marca

Debrief: Planning a report1. Why is it important to plan a report before creating it?

Fundamentals of Report Design—Learner’s Guide8

Page 25: BOC310 en Col91 FV Part Ltr Marca

Lesson summaryAfter completing this lesson, you are now able to:

• Define database concepts• Plan and develop a report prototype

9Planning a Report—Learner’s Guide

Page 26: BOC310 en Col91 FV Part Ltr Marca

Fundamentals of Report Design—Learner’s Guide10

Page 27: BOC310 en Col91 FV Part Ltr Marca

Lesson 2Creating a Report

Lesson introductionCreating a basic report using Crystal Reports will help you turn data into information.

After completing this lesson, you will be able to:

• Create a report• Add tables• Describe the design environment• Insert objects on a report• Preview a report• Save a report• Position and size objects• Format objects

11Creating a Report—Learner’s Guide

Page 28: BOC310 en Col91 FV Part Ltr Marca

Creating a reportIn order to create a report, you must first connect to your database that contains the data youneed.

After completing this unit, you will be able to:

• Describe methods of creating a report• Choose a data source type

Report creation methods

When you launch Crystal Reports, the Start Page appears at the top of the screen.

The Start Page includes links to recent reports you’ve opened, report creation methods, theHelp system, a search functionality, sample reports, and an update service.

You can create a new report with Crystal Reports using these methods:• Use one of the Report Wizards provided.

A user who is unfamiliar with Crystal Reports, or someone who is familiar but is rushed,will find it easier to design a report using one of the Wizards, sometimes referred to asExperts. You step through the report-building process of a specific type of report whenusing an Expert.

Fundamentals of Report Design—Learner’s Guide12

Page 29: BOC310 en Col91 FV Part Ltr Marca

• Construct the report manually, piece by piece.

You can custom design a report using this method by starting with a blank report andbuilding the elements of the report from “scratch.”

• Create a report from another report.

Another quick method to build a report is to create it from an existing report. This existingreport can be used as a template since it may already contain much of the information andformatting you need. After you open the report you want to use as a template, save it to anew file using the Save As command on the File menu.

The Start Page also contains dynamic content from Business Objects.

After you select the type of report you want to build from the Start Page, you choose the datasource you will use to create the report.

Specifying the data source

For any new report you want to create, the first step is to specify the data source.

Regardless of which option you select from the STARTANEWREPORT list on the Start Page,the dialog box that displays will be one of several Data dialog boxes that allow you to specifythe data source from either an existing connection or by creating a new connection.

13Creating a Report—Learner’s Guide

Page 30: BOC310 en Col91 FV Part Ltr Marca

If you choose to use a blank report as the basis of your new report, theDatabase Expert opensautomatically.

The options in theDatabase Expert are:• My Connections

Fundamentals of Report Design—Learner’s Guide14

Page 31: BOC310 en Col91 FV Part Ltr Marca

This option shows all data sources that you are currently connected to.

• Create New Connection

This folder contains a number of subfolders of data source options.

The data you use to create reports in your organization is stored in either a client-server databasesuch as MS SQL Server, or a PC-type database such as Microsoft Access. You access sourcesthrough either an ODBC layer or directly through native drivers. ODBC stands for OpenDatabase Connectivity. It is an interface that gives applications the ability to retrieve data indata management systems.

Note: Salesforce.com is an on-demand customer relationship management (CRM) company.A salesforce.com driver included with Crystal Reports allows for access to customer data.Reports that use a salesforce.com driver refresh when deployed to crystalreports.com.

To connect to an ODBC data source

1. From theDatabase Expert, select Create New Connection.

2. Expand the Create New Connection list and locateODBC (RDO).

3. ClickODBC (RDO) .

15Creating a Report—Learner’s Guide

Page 32: BOC310 en Col91 FV Part Ltr Marca

TheODBC (RDO) dialog box opens.

4. Locate and then click the appropriate data source, and then clickNext.The second window of theODBC (RDO) dialog box appears, displaying the connectioninformation needed to log onto the selected data source.

5. In the Connection Information section of theODBC (RDO) dialog box, enter your user IDand password, if required, and then click Finish.

Tip: In your organization the database may be secure, meaning you might be promptedfor a user ID and password. For this course, the sample database has not been secured.

Fundamentals of Report Design—Learner’s Guide16

Page 33: BOC310 en Col91 FV Part Ltr Marca

TheDatabase Expert displays with the connection to the data source highlighted.

17Creating a Report—Learner’s Guide

Page 34: BOC310 en Col91 FV Part Ltr Marca

Adding tablesAfter connecting to your data source, you will add the information upon which the report willbe built.

After completing this unit, you will be able to:

• Add tables to a report• Describe linking

Adding tables to a report

After selecting the data source, you can add one or more tables to base your report on.

To add tables to a report

1. From theDatabase Expert, expand your data source, and then expand Tables.

2. Select the table you want to add to your report.

3. Click the > arrow to add it to the Selected Tables list.

4. ClickOK.

Fundamentals of Report Design—Learner’s Guide18

Page 35: BOC310 en Col91 FV Part Ltr Marca

Linking database tables

If your report contains data from two or more database tables, you will need to link the tableswhen creating your reports. Linking requires that you use a field that is common to both tables.You link database tables so records from one table match related records from another. Youdefine the linking setup in the Links tab of theDatabase Expert.

Auto Link in theDatabase ExpertLinks tab automatically chooses links for your tables basedon common fields in tables or indexed fields (if your database supports indexed fields).

Note: The color flags indicate that these fields are indexed. Indexed fields can increase the speedof data access and reduce the time it takes for the program to evaluate data.

The other options in the Links tab include:• Links display area

The display area shows all the tables currently in your report along with links and indexes.

• Auto-Arrange

When you click this button, the program arranges the tables to fit in themost efficientmannerinside the Links display area.

• Auto-Link

Use this area to choose a method of linking tables. Click By Name to link tables by theirnames or By Key to use foreign key information. Click the Link button to link tablesautomatically (by name or foreign key, as selected).

• Order Links

19Creating a Report—Learner’s Guide

Page 36: BOC310 en Col91 FV Part Ltr Marca

To activate this button, you must have more than two tables available for linking. Whenyou click the button, theOrder Links dialog box appears. Establish the link processing orderyou want for the available linked tables.

• Clear Links

This option removes all the links in the tables.

• Delete Link

This option removes the selected link.

• Link Options

This option opens the Link Options dialog box when you click a link line to select it.

• Index Legend

This option opens the Index Legend dialog box so you can see a key to the index indicators(arrows) used in the Links display area. The numbering of the index indicators reflects thesequence in which the indexes were created. If a field is part of several indexes, the indexindicator in front of the field shows the colors of the indexes the field is part of.

To link tables

1. Confirm the tables are linked correctly.

2. ClickOK.

Fundamentals of Report Design—Learner’s Guide20

Page 37: BOC310 en Col91 FV Part Ltr Marca

The design environmentTheDesignwindow is the environment in which you will create the report.

After completing this unit, you will be able to:

• Describe theDesignwindow area• Describe toolbars

Understanding the Design window

When creating a report, you begin in theDesign window, also referred to as theDesign tab.

TheDesign tab is where you do most of the initial work when creating a report. It designatesand labels the various sections of the report. You can do the initial formatting; place objects inthe sections where you want them to appear; specify sorting, grouping, and totaling needs;and so forth.

While working in theDesign tab youmanipulate “representatives” or placeholders of objects,not the objects themselves. TheDesign tab offers faster previewing of information and layoutbecause you are not working with the actual data itself. When a field is placed on the report,the program uses a frame to identify the field on the tab; it does not retrieve the data. Thus,you can add and delete fields and other objects, move them around, set up complex formulas,and more, without tying up the computer or network resources needed to gather the data.

The report created in theDesign tab is a kind of virtual report; it has the structure andinstructions for creating the final report, but it is not the report itself. To turn theDesign tab

21Creating a Report—Learner’s Guide

Page 38: BOC310 en Col91 FV Part Ltr Marca

report into a final report or into a report that you can fine-tune, you add data. Data addingoccurswhenever you preview the report, print it, or output it in any other way. The actual dataappears in the report.

When you begin creating a report, Crystal Reports automatically creates five areas or sectionsin theDesignwindow.

• Report Header

This section is used for the report title and other information you want to appear at thebeginning of the report. It can also be used for charts and cross-tabs that include data forthe entire report. Items placed in the ReportHeader print only on the first page of the report.Often the name of the report, the print date, company logo, or “title page” information isincluded in the Report Header.

• Page Header

This section is used for information that you want to appear at the top of each page. Thiscan include such things as chapter names, the name of the document, and other similarinformation. This section can also be used to display field titles above the fields on a report.Objects in the Page Header print at the top of every page of the report. Column headings,print dates, and page numbers are common entries in the Page Header.

• Details

This section is used for the body of the report and is printed once per record. The bulk ofthe report data appears in this section. Place the data fields on which you want to report inthis area. This information (database fields and text) prints for every record selected on thereport.

• Report Footer

This section is used for information you want to appear only once at the end of the report(such as grand totals) and for charts and cross-tabs that include data for the entire report.Items placed here print only on the last page of the report. Grand totals, total number ofpages, and other summary information are often placed here.

• Page Footer

Fundamentals of Report Design—Learner’s Guide22

Page 39: BOC310 en Col91 FV Part Ltr Marca

This section usually contains the page number and any other information youwant to appearon the bottom of each page. Objects placed here print at the bottom of every page. Pagenumbers are often placed in the Page Footer.

Note: The names of the five areas can also be shortened to their abbreviated forms (RH, PH, D, RF,and PF). You set the Short Section Name option in theDesign View area of the Layout tab in theOptions dialog box from the Filemenu. You can also set this option by right-clicking on one of thesection names and selecting Show Short Section Names from the shortcut menu.

Each section is indicated by a section boundary. These lines indicate the separation of the areasand do not print to paper.

You can move these bars to change the amount of space reserved for each section. You clickand drag the section divider to the desired position; however, you can drag the bottom lineonly to affect the size of the section.

Working with toolbars in the Design window

The Report Designerwindow includes several toolbars. Crystal Reports groups severalcommonly used commands on a toolbar that remains on screen at all times unless you chooseto turn it off using the Toolbar command on the Viewmenu.

The toolbars are:• Standard

This toolbar contains several commonly used commands.

• Formatting

This toolbar contains commands for formatting the selected field.

• Insert Tools

23Creating a Report—Learner’s Guide

Page 40: BOC310 en Col91 FV Part Ltr Marca

This toolbar provides quick access to advanced report enhancing features.

• Expert Tools

This toolbar provides quick access to many advanced experts.

• Navigation Tools

This toolbar provides buttons for refreshing a report’s data and for moving around thereport.

• External Command

This toolbar is where organizations can access custom applications or plug-ins that theyhave created for Crystal Reports.

Note: The ability to customize Crystal Reports by using Add-ins in the Report Designer allowsreport developers to extend the functionality of the application. This customization can includeapplication-specific toolbars, branded billboards, splash screens, and launching of other applications.This flexibility provides opportunities to customizeCrystal Reports to your company's specifications.

The toolbars are floating toolbars. You can position them on any of the four sides of the screen,or float them on your design area. Each toolbar displays an icon that visually describes thecommand it represents. You activate a toolbar command by clicking the appropriate icon.

To move a toolbar, click and hold in an unused part of the toolbar, between groups of buttons,or on the unused area at the beginning or end of the toolbar. Drag the entire toolbar to thedesired location. As you approach the edge of the screen, the toolbar automatically stretchesto match that side.

The toolbar eliminates some of the steps needed to activate a command, increasing the speedwith which you create reports.

Tip: If you are not sure about the function of a button on the toolbar, place the pointer over theicon and hold it there until a tooltip appears.

Fundamentals of Report Design—Learner’s Guide24

Page 41: BOC310 en Col91 FV Part Ltr Marca

Inserting objects on a reportTo create a report, you need to place information on the report.

After completing this unit, you will be able to:

• Describe the Field Explorer• Describe the Report Explorer• Describe the Repository Explorer• Describe theWorkbench• Determine data field type

Working with the Field Explorer

Database fields, formula fields, lines, and boxes are examples of the types of objects you canplace, move, and resize on your report. You access and insert these objects onto the report fromthe Field Explorer.

Use the Field Explorer to insert, modify, or delete fields on theDesign and Preview tabs. You’llsee the Field Explorer after you have:• Clicked the Field Explorer button on the Standard toolbar.

• Selected the Field Explorer from the Viewmenu.

The Field Explorer displays a tree view of database fields and special fields that you can addto your report. It also shows formula fields, SQL expression fields, parameter fields, groupname fields, and running total fields that you have defined for use in your report.

You can dock the Field Explorer dialog box. In free-floating mode, drag the Field Explorer toany location. Alternately, dock the Field Explorer as a tab, similar to theDesign tab.

The Field Explorer’s toolbar offers these functions:• Insert to Report

25Creating a Report—Learner’s Guide

Page 42: BOC310 en Col91 FV Part Ltr Marca

Use this option to add a field to the report. You can insert more than one field at a time byselecting multiple fields, right-clicking, and choosing Insert to Report.

Alternatively, to insert a field, you can drag and drop it in theDesign or Preview tabs.

• Browse

Use this option to browse data for a database field, formula field, or SQL expression field.

• New

Use this option to create a formula field, SQL expression field, parameter field, or runningtotal field.

• Duplicate

Use this option to make a copy of the formula that you have selected in the Field Explorer.Once the copy is created you can rename and edit it.

• Edit

Use this option to modify an existing formula field, SQL expression field, parameter field,or running total field.

• Rename

Use this option to modify the name of an existing formula field, SQL expression field,parameter field, or running total field.

• Delete

Use this option to remove a formula field, SQL expression field, parameter field, or runningtotal field. You can also selectmultiple fields, right-click, and chooseDelete to remove themall at once.

Tip: Each button on the Field Explorer’s toolbar has an associated shortcut option that’s displayedin the tooltip.

To insert fields onto a report

1. On the Standard toolbar, click Field Explorer.

Fundamentals of Report Design—Learner’s Guide26

Page 43: BOC310 en Col91 FV Part Ltr Marca

The Field Explorer dialog box appears. To speed the report building process, this dialogbox remains on screen until you close it. You can move this dialog box wherever you want.

2. Expand theDatabase Fields folder to see all the tables chosen from the database(s).

3. Expand the individual tables to see all the fields they contain.

4. Select the field you want to appear in the report.

5. Click Insert to Report and then click to place it in the report.

Tip: You can insert more than one field at a time by selectingmultiple fields, right-clicking,choosing Insert to Report, and then clicking in the report to place them. You can also dragand drop fields to add them to the report. You can right-click the field in the Field Explorerto invoke a shortcut menu that displays the Insert to Report option.

After you place a field onto a report, a checkmark appears on the field in the Field Explorer.

Working with the Report Explorer

The Report Explorer appears when you select the Report Explorer command from the Viewmenu, or when you click the Report Explorer button on the Standard toolbar. The ReportExplorer displays a tree view of the sections in your report and lists the report objects containedin each section and works like a “report navigator.” You can work with report objects directlyfrom the explorer.

The Report Explorer's toolbar provides buttons that let you expand or collapse your report'stree view and choose the report items to display by type:• Expand

Use this option to expand all child nodes of the tree view under the selected node. If youselect this option while the root node is highlighted, all remaining nodes are expanded. Ifyou select this option while a child node is highlighted, only the nodes that are part of thechild are expanded.

27Creating a Report—Learner’s Guide

Page 44: BOC310 en Col91 FV Part Ltr Marca

Note: This option has no effect if selected while a report object is highlighted, or if theselected node has no children.

• Show/Hide Data Fields

Use this option to show or hide data fields in your report. Data fields include formula fields,summary fields, and text objects.

• Show/Hide Graphical Objects

Use this option to show or hide graphical objects in your report. Graphical objects includecharts, maps, boxes, lines, BLOB fields, and OLE objects.

• Show/Hide Grids and Subreports

Use this option to show or hide cross-tabs, OLAP grids, and subreports in your report.

You can dock the Report Explorer dialog box. In free-floating mode, drag the Report Explorerto any location. You can also dock the Report Explorer as a tab, similar to theDesign tab.

The content of the Report Explorer represents the content of the report in a tree view. The rootnode is the report itself, while the first-level nodes represent the report's sections.

Within each section, the report's fields and objects are listed. Any item you select in the treeview will be selected in the report (in eitherDesign or Previewmodes).

You can modify report fields and objects by selecting them in the Report Explorer. When youright-click the selected item, you see a menu that contains the actions you can carry out on theitem.

For example, if you right-click a text object, the menu contains the options to edit the text, toformat its font or color, and so on. Likewise, if you right-click a section node, themenu containsthe options to hide, suppress, format, and so on.

Fundamentals of Report Design—Learner’s Guide28

Page 45: BOC310 en Col91 FV Part Ltr Marca

Note:• You can select multiple fields for formatting by using Ctrl-click; however, you cannot add

additional fields or report objects when using theReport Explorer, but you can delete them.• Items connected to a BusinessObjects Enterprise Repository are shown with the repository

icon beside them.• Items with hyperlinks are shown as blue text with a solid underline. Items with Report Part

hyperlinks are shown as green text with a dashed underline. These indicators are availableif you are using a Microsoft Windows operating system only.

• You can use the openDocument function to create hyperlinks to other types of reports (forexample, Web Intelligence reports).

To use the Report Explorer

1. Click the Report Explorer icon on the Standard toolbar.

29Creating a Report—Learner’s Guide

Page 46: BOC310 en Col91 FV Part Ltr Marca

The Report Explorer appears.

2. Right-click the field you want to format and select the option you want to apply from theshortcut menu.

3. Apply the changes.

Working with the Repository Explorer

The repository is the central location for you to store and manage your report objects. Theseobjects are accessible to users and report developers for use in new reports. Physically, therepository is a database that stores supported object types:• Text objects• Bitmaps• Custom functions• Commands (queries)• List of Values

Fundamentals of Report Design—Learner’s Guide30

Page 47: BOC310 en Col91 FV Part Ltr Marca

The Repository Explorer’s toolbar provides buttons that let you add new folders, search foritems, and so on:• Change view settings

Use this option to open the View Settings dialog box. Use this dialog box to limit the typeof repository items displayed in theRepository Explorer. You can also select options to sortmultiple items by name or by type.

• Advanced filtering

Use this option to display filtering options at the bottom of the Repository Explorer. Usethese filters to find specific items bywords from theName orAuthor fields in theAdd Itemdialog box.

Note: Text entered in the filtering fields of this option is not case sensitive.

• Delete the item/folder

Use this option to permanently remove the selected item or folder from the repository.Whenyou delete a folder, you delete all the items it contains.

• Insert a new folder

Use this option to add a new folder to the repository.

• Logon/Logoff

Use this option to log on/off the repository in BusinessObjects Enterprise.

Note: If you aren’t logged on, a no server connectionmessage is displayed in theRepositoryExplorer.

Tip: Hover yourmouse’s cursor over any object in theRepository Explorer to see a tooltip. Tooltipsfor text objects and bitmaps include Author and Description information as well as the completetext of the SQL statement.

By maintaining a shared repository of report objects, you can modify a particular object andupdate all reports containing that object as they are opened for use. A central location for reportobjects also helps with the task of managing your data—an important benefit in maximizingproductivity and minimizing costs at your company.

The BusinessObjects Enterprise Repository is contained in BusinessObjects Enterprise.Depending on the version of Crystal Reports you have, you can install a version ofBusinessObjects Enterprise to access the repository.

You can dock the Repository Explorer dialog box. In free-floating mode, drag the RepositoryExplorer to any location. You can also dock the Repository Explorer as a tab, similar to theDesign tab.

To open the Repository Explorer

1. Click the Repository Explorer icon on the Standard toolbar.

31Creating a Report—Learner’s Guide

Page 48: BOC310 en Col91 FV Part Ltr Marca

Tip: Another way to do this is to click the Repository Explorer option under the Viewmenu.

2. If you’re not logged onto the repository in BusinessObjects Enterprise, click theLogon buttonon the toolbar in the Repository Explorer.The Log On to BusinessObjects Enterprise dialog box opens.

3. Enter the appropriate information into the System, User name, Password, andAuthentication text boxes.

4. ClickOK.The Repository Explorer appears, displaying the contents of the repository.

5. Expand the top node to see the repository contents, if required.

Fundamentals of Report Design—Learner’s Guide32

Page 49: BOC310 en Col91 FV Part Ltr Marca

Working with the Workbench

TheWorkbench is a folder structure that can represent the type of projects you work on. IntheWorkbench, you can create projects (folders) that contain one ormore reports. For example,if you are a report designer in the financial department of an organization, you could haveseparate folders for Accounts Payable and Accounts Receivable.

Use the options on the toolbar to add, remove, or rename folders, reports, and object packages.You can reorganize the files in a folder or folders by dragging and dropping them where youwant them to appear. You can also drag report files fromWindows Explorer and drop theminto the folder of your choice in theWorkbench.

TheWorkbench includes a toolbar:• Add

Use this option to add a new object to theWorkbench:○ Add Existing Report or Add Current Report

When you select this option, theOpendialog box appears so that you can search for a Crystalreport that you have previously created.○ Add New Project

When you select this option, the program adds a new folder under the root node that iscalledWorkspace. You can add reports to this folder. Project folders offer a way to organizethe reports in theWorkbench.○ Add Object Package

When you select this option, the program prompts you to log onto your BusinessObjectsEnterprise system. When you have connected to your system, you can choose an objectpackage to add to theWorkbench.

• Open

Use this option to open the report or report package that you have selected in theWorkspacefolders.

• Check Dependencies

Use this option to initiate theDependency Checker, a method of checking for errors in areport. The option is available for individual reports or for folders of reports. Crystal Reportsbegins checking the report(s) immediately and displays the results in theDependencyChecker.

You can right-click any item in the workspace area of theWorkbench to see a shortcut menu.Many of the options that are available on the shortcut menu are also available on the toolbar.This section describes only the additional options that are not available on the toolbar.• Rename

Use this option to rename a folder in theWorkspace area.

• Remove

Use this option to remove a report, report package, or folder from theWorkspace area.

33Creating a Report—Learner’s Guide

Page 50: BOC310 en Col91 FV Part Ltr Marca

Note:• You cannot undo this option.• When you remove a folder, you remove all of the items in it at the same time.

• Publish to BusinessObjects Enterprise

Use this option to publish a folder of reports to BusinessObjects Enterprise. You can publishyour reports individually or as an object package. (Object packages can be scheduled inBusinessObjects Enterprise as a single entity.) When you choose this option, the PublishObject dialog box appears.

To add a new project to the Workbench

1. Click theWorkbench button on the Standard toolbar.TheWorkbench appears.

2. Right-click Create a new project in the workspace of theWorkbench, point to Add, andthen click Add New Project.An untitled folder appears.

3. Enter a name for the project, and then click in the white space area of the workspace to setthe project folder.

Fundamentals of Report Design—Learner’s Guide34

Page 51: BOC310 en Col91 FV Part Ltr Marca

To add a report to the Workbench

1. Click the project folder in theWorkbench.

2. From the Addmenu, click Add Existing Report.

3. Locate the report you want to add from theOpen dialog box, and then clickOpen.The report is added to the folder.

Determining data field types

You can take a look at a sample of the actual data in the table before you place the field on yourreport in the Browse Field Data dialog box.

To browse field data

1. Select the field.

2. From the Field Explorer, click Browse.The Browse Data dialog box opens.

3. Scroll through the list.

4. Click Closewhen finished.

35Creating a Report—Learner’s Guide

Page 52: BOC310 en Col91 FV Part Ltr Marca

Note: The default setting is either to display the first 500 records or to time out at fiveseconds, depending on what has been set up. If you have large tables with more than 500records, you will not see examples of all the data contained in the fields.

Tip: You can also browse the field data in the database tables after you place the field onthe report by right-clicking the field and selecting Browse Field Data from the shortcutmenu.

Fundamentals of Report Design—Learner’s Guide36

Page 53: BOC310 en Col91 FV Part Ltr Marca

Previewing a reportWhen you create a new report, you begin in theDesign tab. You can view the report in thePreview tab to see the results of your design. Once in the Preview tab, you can evaluate theformatting and layout of your design.

After completing this unit, you will be able to:

• Describe the methods of previewing a report• View a report• Explain the differences between working in theDesign and Preview tabs• Describe page controls• Describe the status bar

Previewing reports

Once you have placed data fields on your report, you are ready to preview your design. Themethods to switch to the Previewwindow are:• Click the Print Preview button on the Standard toolbar.• Click theHTMLPreview button on the Standard toolbar to see anHTML rendering of your

Crystal report as it will appear when published to the web.• Click the Refresh button to the far right of the Report Designer’s screen.

Tip: The area at the bottom of theReport Designer environment is called the page controlsarea, which shows you the date and time that the data was last refreshed.

The program gathers the data, makes the necessary calculations, and displays the report in thePreview tab. With the data in place, you can review the spacing and formatting of your reportand see the actual results of all your summaries, formula calculations, and record and groupselections.

The program works with data in this manner:• The first time the Preview tab is used, it retrieves data from your underlying data source(s)

and saves it with the report (unless you have set up the program not to save data).• From that point on, the program uses the saved data whenever you preview the report

unless you specifically refresh it or add a field that requires the program to retrieve newdata.

When you save data with a report, the data is saved in a cache file with the report on theclient machine.

Note: You retain full design capabilities in the Preview tab.

When you need to make sure that your report design is appropriate and correct over the webin a zero-client environment, theHTML Preview option lets you see an instant rendering ofyour report to HTML without leaving the Crystal Reports design environment. Unlike thePreview tab, which shows the true report format, theHTML Preview tab shows a convertedformat. By switching between the two tabs, you can make adjustments in your report designto yield the best results on the web.

37Creating a Report—Learner’s Guide

Page 54: BOC310 en Col91 FV Part Ltr Marca

In the case of reports that are published to BusinessObjects Enterprise (managed reports), youdon’t have to do any special configuration to make theHTML Preview feature work.

For stand-alone reports (unmanaged reports), the program must use a stand-alone ReportApplication Sever (RAS) to generate the preview. In this case, you need to configure theHTMLPreview feature. Do this in the Servers tab of theOptions dialog box in Crystal Reports.

If you open a large report inHTML Preview, a progress indicator displays. Once the report isopen in HTML Preview, you will see a stationary group tree to the left of the report and astationary toolbar above the report. You can use the group tree and toolbar to navigate fromone page of the report to another without scrolling up and down. TheHTML Preview alsodisplays the page margins so you know what the report will look like if it is printed.

Viewing a report

Crystal Reports provides two views for previewing a report:• Standard view• Preview panel

Standard view

In the standard view, the report is displayed one page at a time.

Fundamentals of Report Design—Learner’s Guide38

Page 55: BOC310 en Col91 FV Part Ltr Marca

Using the navigation buttons in the Preview tab, you can move to the beginning or end of thereport, or you can move backward and forward through the report one page at a time.

For shorter reports or reports in which you're primarily interested in seeing the “bottom line”totals, the standard view provides all of the functionality you need.

Preview panel

You can display or hide thePreviewpanel usingToggle PreviewPanel on theStandard toolbar.

The Preview panel view presents a split screen:• The right pane displays the report.• The left pane displays a high-level outline of the report, showing the hierarchy of groups

and subgroups in a familiar tree format.

The Preview panel typically displays the names of the groups and subgroups you created inyour report. You can, however, customize these names using theOptions tab of the InsertGroup or Change Group Options dialog box.

When you click the tree node for the group that interests you, the program jumps immediatelyto the part of the report that contains the information for that group. For longer reports orreports in which you want to jump back and forth between different groups, the navigationfeatures of the Group Tree view make your work extremely efficient.

39Creating a Report—Learner’s Guide

Page 56: BOC310 en Col91 FV Part Ltr Marca

Zooming in and out

Zooming enables you to move from a full-page view to a zoom between 25% and 400% as wellas the Whole Page and Page Width options. Taking a “bird’s-eye view” of your report givesyou an idea of the overall layout of your report, letting you see if graphics are positionedproperly, and so on. Zooming in at a highmagnification level lets you focus on the finer detailsof your report. Magnification factors can be set to different percentages in theDesign andPreview tabs.

Page controls

Page controls enable you to move forward or backward through the report one page at a time,to move to the first or last page, to cancel the printing of the report, and to close tabs.

The Data Age indicator indicates the date the data was last refreshed or initially retrieved,whichever is the most recent. If the data was initially retrieved or refreshed today, it indicatesthe time it happened.

The status bar

The status bar is found at the bottom of theDesign tab and displays the selected field name,its position on the report, and howmany records were returned. When you hover your cursorover a button on the toolbars, the status bar displays a tooltip.

You can show or hide the status bar by using the Status Bar command on the Viewmenu. Bydefault, the status bar is shown (a check mark appears beside the command on the menu).

Working in the Design and Preview tabs

Often, you will find it easier to work in theDesign tab when working with multiple sectionsand areas. You may sometimes want to work in the Preview tab where you can see the effectsof your changes instantly and how the report will be printed.

You have the same formatting capabilities in the Preview tab as you do in theDesign tab.Menus (both menu bar and shortcut menus) and toolbars remain active, providing essentiallythe same functionality you have when working with a report in theDesign tab. However,when you are making numerous changes, it is quicker to make the changes in theDesign tab.

Some additional things to consider are:• TheDesign tab and Preview tab are tied together internally. Any changes made in one are

reflected in the other.

Fundamentals of Report Design—Learner’s Guide40

Page 57: BOC310 en Col91 FV Part Ltr Marca

• The Preview tab has a single vertical ruler at the left of the tab rather than the individualsection rulers seen in theDesign tab. The functionality of the ruler is the same.

• The Preview tab identifies report sections in the shaded area to the left of the data. With aquick look you can tell which report section the data is printing from. While section namesappear only once in theDesign tab, they print each time a section prints in the Preview tab.

• The record counter, the Data Age indicator, and the Page Forward/Page Back controls areall active in the Preview tab.

• The Preview tab highlights every value when you select a field, whereas, only the fieldframe is highlighted in theDesign tab.

Working in the Preview tab has a different feel from working in theDesign tab. Each field ina database contains dozens, hundreds, or even thousands of values, depending on the numberof records in the database. When you place a field in theDesign tab, a single field framerepresents all those values. When you highlight the field, sizing handles appear on the frameand the frame changes color.

In the Preview tab, however, you are working with the actual data. Instead of a field framerepresenting many field values, the values themselves appear. When you highlight a field orformula field value, you are actually selecting every value in the field:• The program places a sizing frame around the specific value you select.• It highlights every other value in the field.

Aside from the differences in appearance, the process of building and modifying a report isthe same in both theDesign tab and the Preview tab.

Tip: When working in the Preview tab, remember that each change you make may require extratime to process because you are working with the actual data, not just the placeholders (as in theDesign tab).

41Creating a Report—Learner’s Guide

Page 58: BOC310 en Col91 FV Part Ltr Marca

Saving a reportYou can add information to better describe the report and then save your report to a numberof options in the Save dialog box.

After completing this unit, you will be able to:

• Add summary information• Save a report• Check a report for errors

Adding summary information

You can save summary informationwith the report. Summary information contains such thingsas the report author, report title, and comments.

Theremay be timeswhen youwant to include non-printing commentswith a report (a personalnote to the report recipient, a note to explain more thoroughly the data on which the report isbased, a report title, or a comment about some particular data on the report).

Summary information provides a facility for including anything from a short note to hundredsof lines of text with your report. The comments do not print with the report; they remain inthe Summary tab of theDocument Properties dialog box where they can be reviewed ondemand.

To add summary information

1. Select File ➤ Summary Info.TheDocument Properties dialog box appears with the Summary tab active.

Fundamentals of Report Design—Learner’s Guide42

Page 59: BOC310 en Col91 FV Part Ltr Marca

2. Enter the desired information and clickOKwhen finished to return to your report.

Saving a report

The saving function is the same in Crystal Reports as in many other applications. TheOpen,Save, andSaveAsdialog boxes enable you to open or save a report conveniently to personalizedfolders that are created by your operating system. If one of these folders does not exist on yourmachine, the corresponding button will not be displayed.

The personalized folders are:• Desktop

This folder contains the contents of your Windows Desktop.

• My Documents

This folder typically contains theHistory,My eBooks, andMy Pictures folders.

• Favorites

This folder contains your frequently-accessed files.

• CR.COM

Crystalreports.com is a report-sharing service that you can use to distribute your reportsover the Web, instead of by email or hard copy.

• Enterprise

If your company has deployed BusinessObjects Enterprise, aweb-based reportmanagementtool, you can log onto the system so you can view the reports stored on the Enterprise system.

• My Connections

This folder shows a list of data sources to which you are connected.

43Creating a Report—Learner’s Guide

Page 60: BOC310 en Col91 FV Part Ltr Marca

Saving a preview of a report

You can save the first page of a report as a preview or “snapshot” of a report so that you canview the report when opening it. You can also preview a sample of the data.

Some considerations include:• You must preview the report before a snapshot can be taken.• The snapshot is only updated when you preview. If you turn on the feature in theDesign

tab, but do not preview, the snapshot will not be taken. Also, if you modify the report intheDesign tab, and save the report but do not preview, the snapshot will not be updated.

• Because the snapshot is saved in the report file, the addition of the preview picture mayincrease the size of the file.

To save a snapshot of a report

1. Preview the report.

2. Select File ➤ Summary Info.TheDocument Properties dialog box opens.

3. In the Summary tab of theDocument Properties dialog box, select the Save PreviewPicturecheck box, if required.

Note: The Save Preview Picture check box is active by default.

4. ClickOK.

Fundamentals of Report Design—Learner’s Guide44

Page 61: BOC310 en Col91 FV Part Ltr Marca

To preview the snapshot

1. Click File ➤ Open.

2. Click the Preview button (last button on the toolbar).

3. Click the report you want to preview.You will see a snapshot of the first page of the report.

Checking a report for errors

TheDependency Checker appears when you check a report or project for errors in theWorkbench, or when you select the command on the Reportmenu for a report that you haveopen in Crystal Reports. TheDependency Checker registers several types of errors:• Report part hyperlink errors• Repository object errors• Formula compilation errors

You can use theDependency Checker on an opened report in the Report Designer, or youcan select a report in theWorkbench to check for errors.

Errors listed in theDependency Checker show the following information:• Error type

MeaningIcon

Success. TheDependency Checker hasverified that there are no errors in the file.

45Creating a Report—Learner’s Guide

Page 62: BOC310 en Col91 FV Part Ltr Marca

MeaningIcon

Warning. TheDependency Checker hasfound something in the file that might be aproblem. You can verify thewarning, but youdon’t have to fix it to have the report runcorrectly.

Error. TheDependency Checker has foundan error that you must fix so that the reportwill run correctly.

• Description of the error• Location of the file that contains the error

Double-click an error to open the target report and go to the report object so that you can fixthe problem. If the report object cannot be found (because, for example, you’ve deleted part ofthe report since checking for errors), you receive amessage that recommends you run the checkagain.

When you right-click a message in theDependency Checker, a shortcut menu appears withthese options:• Go To

Use this option to open the report that contains the error and to go to the object that iscausing the problem. You can also select a message and press Enter or double-click to openthe report.

• Sort By

Use this option to sort the messages by type, number, description, or location.

• Clear

Use this option to remove the selected message.

• Clear All

Use this option to remove all of the messages.

• Copy

Use this option to copy the message to the clipboard so that you can paste it into anotherapplication.

• Options

Use this option to open theDependency Checker tab of theOptions dialog box. Use thistab to select the conditions that you want to check for when you run theDependencyChecker.

Fundamentals of Report Design—Learner’s Guide46

Page 63: BOC310 en Col91 FV Part Ltr Marca

To check a report for errors using the Dependency Checker

1. Select a report or project in theWorkbench.

2. Click theDependencyChecker button on theWorkbench toolbar or on theStandard toolbar.A status message appears in theDependency Checker.

3. If an error occurs, right-click the message and selectGo To to open the report that containsthe error and to go to the object that is causing the problem.

Tip: You can also select a message and press Enter or double-click to open the report.

Activity: Creating a report

Objective

• Create a report from a blank report by using the Customer table andOrders table from theXtreme Sample Database (via an ODBC data source).

Instructions

1. Create a report by using the Blank Report option on the Start page.

2. Add the Customer table and theOrders table.

3. Add these database fields in the report:• Customer Name• City• Region• Order Amount• Order ID• Order Date

4. Once you have placed your data fields onto your report, preview it.

5. Delete the print date and page number that appear by default.

47Creating a Report—Learner’s Guide

Page 64: BOC310 en Col91 FV Part Ltr Marca

6. Open the Report Explorer. notice the objects listed in the Report Explorer that appear onyour report.

7. Change the magnification in the Preview tab with the toobar button.

8. Click Zoom to further explore the magnification options.

9. Add summary information (Report Author, Comments) and save a snapshot.

10.Save the report as Creating a report.rpt to My Documents.

Note: Save all subsequent activity reports to My Documents.

11.Create a project called Report Design I in theWorkbench.

12.Add the newly created report into this project folder.

Note: Add all subsequent activity reports to this project in theWorkbench.

13.Check the report for errors by using theDependency Checker.

Your report should look similar to this example in the Previewwindow.

Fundamentals of Report Design—Learner’s Guide48

Page 65: BOC310 en Col91 FV Part Ltr Marca

Positioning and sizing objectsOnce you have placed fields and objects on your report, you may want to reposition or resizethem. You can reposition and resize objects from either theDesign or the Preview tab.

Tip: Positioning and sizing objects is easier in theDesign tab because you are moving onlythe placeholder rather than the representative data.

After completing this unit, you will be able to:

• Position objects using a grid• Position objects using guidelines• Position objects using free form placement• Lock an object’s position and size• Move objects• Align objects• Resize objects• Cut, copy, and paste objects

Positioning objects using a grid

Different reporting needs require different methods of positioning objects on your report. Thedefault setting in Crystal Reports is Snap to Grid.

A grid is an imaginary series of vertical and horizontal lines across your working area, muchlike graph paper. A series of dots can be displayed on theDesign area, each one marking theintersection of a vertical and horizontal gridline.

49Creating a Report—Learner’s Guide

Page 66: BOC310 en Col91 FV Part Ltr Marca

When using Snap to Grid, your objects are placed at a gridline. As you move objects around,they “snap” from gridline to gridline. This functionality makes it easy to line up objects bothhorizontally and vertically.

TheGrid display and Snap to Grid on/off options are independent of each other. You alsocan choose to see the grid in both theDesign and Previewwindows.

To select the grid display option

1. Click File ➤ Options ➤ Layout.TheOptions dialog box appears.

2. Select theGrid check box to visually display the grid in theDesign tab.

3. Confirm that Snap to Grid is selected to have objects align automatically.

Tip: You can also right-click over a blank area of the report window, and then access theSnap to Grid from the shortcut menu.

4. ClickOK.

Fundamentals of Report Design—Learner’s Guide50

Page 67: BOC310 en Col91 FV Part Ltr Marca

Positioning objects using guidelines

If youwant to line objects upwith one another, you can insert a guideline and attach the objectsto it. Then, in one step, you can move the guideline to reposition all the objects attached to theguideline.

When theGuidelines check box is selected, Crystal Reports automatically places a verticalmarker in the ruler for each field you place in theDetails area. These markers or “handles” letyou move the fields and their column headings horizontally on your report at the same timeby moving the guideline arrowhead.

Tip: Remember that guidelines are visible in both theDesign and Previewwindows only if youhave theShowGuidelines inDesign andShowGuidelines in Preview check boxes selected underFile ➤ Options ➤ Layout. The guideline handles will not appear in the Preview tab unless youselect an object on the report.

When you click a field to move or resize the object, tracker guidelines appear, aligning theobject against the horizontal and vertical rulers to let you clearly see the placement.

Caution: You can have as many guidelines as you want, but beware of “guideline clutter.” If youfind yourself withmany guidelines on your report, objects can be attached at both ends. In this case,if youmove a guideline, any object attached to it will be stretched because the other side is anchoredby the other guideline.

To select the guidelines option

1. Click File ➤ Options.

51Creating a Report—Learner’s Guide

Page 68: BOC310 en Col91 FV Part Ltr Marca

TheOptions dialog box appears.

2. Click the Layout tab, if not visible.

3. Select theGuidelines check box in theDesign (or Preview) area, and then clickOK.

To create guidelines

1. Click in either the vertical or horizontal ruler.A small triangle (arrowhead) displays pointing to theDesignwindow with a dashed lineextending from it to the opposite side of theDesign area. Objects dragged to this guideline“attach” themselves to it, ensuring that all objects are lined up together.

2. Attach all the objects that you want to manipulate then drag the guideline arrowhead tomove all the objects together.

Note: Clearing theGuidelines check box in theOptions dialog box causes your guidelinesto disappear within theDesignwindow. However, the arrowheads still show in the rulerlines so you can still move objects that are attached to the now invisible guideline.

Fundamentals of Report Design—Learner’s Guide52

Page 69: BOC310 en Col91 FV Part Ltr Marca

To remove an object from a guideline

1. Drag the object away from the guideline.

To remove a guideline

1. Drag the guideline arrowhead in the ruler away from theDesignwindow.

Removing a guideline is similar to removing a tab from a word processor ruler line.

To remove all guidelines

1. Right-click the guidelines and select Remove All Vertical Guidelines or Remove AllHorizontal Guidelines from the shortcut menu.

Positioning objects using free-form placement

If you turn the gridlines and Snap to Grid off, you have the freedom to place objects anywhereon theDesignwindow you want. Objects can even be placed offset from one another.

Tip: For the examples and activities in this training guide, keep Snap to Grid selected. You canchoose to show the grid or not.

Locking an object’s position and size

You can lock the position of the selected report object so it can’t be moved. When you set thisoption, you cannot drag the object in theReportDesigner and the Size and Position commandbecomes inactive.

To lock an object’s size and position

1. Select the object whose size and position you want to lock.

2. On the Formatting toolbar, click Lock Size/Position.

Moving objects

You need to select an object before you can move or resize it.

In theDesign tab, you can select lines and boxes with other objects such as text, fields, charts,maps, OLAP grids, cross-tabs, and OLE objects.

In theDesign and Preview tabs, you can select multiple objects such as text, fields, charts,maps, OLAP grids, cross-tabs, and OLE objects.

53Creating a Report—Learner’s Guide

Page 70: BOC310 en Col91 FV Part Ltr Marca

Some of the operations deal with the concept of the main object, the last object you select.Certain limitations apply in certain operations:• If the new location of a multiple objects selection does not accommodate all the selected

objects, then the main object and those that can be accommodatedwill be moved. The otherobjects will remain in their original locations. However, if the new location does notaccommodate the main object, then no object will be moved.

TheMove submenu includes these commands:• Backward

When you havemultiple objects in a stack, use the Backward command tomove the selectedobject backward (down) one layer in your stack. In order to access an object you havemovedbackward, you can move objects that are above it out of the way or move those objectsbackwards.

• To Back

When you have multiple objects in a stack, use the To Back command to move the selectedobject to the bottom of the stack.

• Forward

When you have multiple objects in a stack, use the Forward command to move the selectedobject forward (up) one layer in the stack.

• To Front

When you have multiple objects in a stack, use the To Front command to move the selectedobject to the front (top) of the stack.

To select a single object

1. Click the object once to activate the handles.

To select multiple objects

1. Ctrl-click each object in succession.You can also right-click the section and click Select All Section Objects from the shortcutmenu.

To move a single object

1. Click the object once to activate the handles.

2. Move your cursor over the object until the four-way cursor appears.

3. Click and drag the object to a new position.

Fundamentals of Report Design—Learner’s Guide54

Page 71: BOC310 en Col91 FV Part Ltr Marca

To move multiple objects with the four-way cursor

1. Select the objects.

2. Click the first object once to show its handles, then hold down the Ctrl key on your keyboardand click the other objects.As you do this, handles appear on all the objects

3. Once you have selected all desired objects, release the Ctrl key, and then click and hold onany of the selected objects.The four-way cursor appears as you drag the objects to a new position.

To select multiple objects with a marquee or lasso

Tip: Clear any selected objects before using the marquee or lasso by clicking in the white sectionof theDesign tab before you draw the lasso.

1. Using the cursor, click and hold to draw an imaginary box around the objects you wantselected.When you release the mouse, all objects partially surrounded by the marquee are selected.

2. Once you have selected multiple objects, click and hold on any of the selected objects anddrag the objects to a new position.

3. Once your objects are in their new position, click an unused area of theDesignwindow toclear your object selections.

To move multiple objects with a guideline

When you placed your database fields into theDetails area, the fields were attached toguidelines. You canmove all fields attached to a guideline by grabbing the guideline arrowheadand moving it to a new position.1. Create a new guideline by clicking in either the horizontal or vertical ruler bar with the

cursor.

2. Drag objects to that guideline to attach them to the line.

3. Once all objects are attached, you can move the guideline arrowhead to move the objects.This method is handy when you want to move objects or line them up.

To move objects in a stack

1. Right-click an object, point toMove, and then click the appropriate command.

55Creating a Report—Learner’s Guide

Page 72: BOC310 en Col91 FV Part Ltr Marca

Aligning objects

The main object is the object that you want to align other objects with. To make an object themain object, click it last when doing a control-click multiple selection. You can align selectedmultiple objects based on the position of the main object:• Tops, Middles, Bottoms• Baseline• Lefts, Centers, Rights• To Grid (Snap to Grid)

You can change the main object by right-clicking a new object.

Some of the operations deal with the concept of the main object, the last object you select.Certain limitations apply in certain operations:• You can select multiple objects in the same section or different sections of a report and align

them, with the condition that the alignment will not result in an object being moved to adifferent section of the report. For example, if you select an object in theReport Header andanother object in the Page Header, you can align them vertically but not horizontally sincemoving objects horizontally would result in moving one of the objects to a different section.

To align objects

1. Select the objects.

2. Click Format ➤ Align and select the required alignment from the list.You can also right-click the object and select Align from the shortcut menu.

Resizing objects

You can resize objects according to:• Width

• Height

• Size

To resize an object

1. Click the object once to select it.When the broken line frame and handles appear, the object is selected.

2. Drag one of the handles with the double-arrow sizing cursor to change the size of the object.This cursor may appear as vertical, horizontal, or diagonal, depending on the handle youhave grabbed.

Fundamentals of Report Design—Learner’s Guide56

Page 73: BOC310 en Col91 FV Part Ltr Marca

You can resize multiple objects at the same time by selecting them, then using thedouble-arrow sizing cursor to stretch or shrink objects.

To resize objects based on the main object

1. Ctrl-click the objects once to select them.The last object you select is the main object. The size of the main object is used to resize theother selected objects.

2. Right-click the main object and select Size from the shortcut menu.You can also click Format ➤ Size.

3. Select Same Width, Same Height, or Same Size to resize the objects.

Cutting, copying, and pasting objects

To facilitate faster report design, you can copy and paste objects from one section to anotherarea. When you copy an object, you are copying the actual data value of that object, not justthe object definition. This way, you can copy and paste objects with data to other applications(as text, metafile, bitmap, and so on).

You can copy an object from the Preview tab to the clipboard, retaining the object’s properties.If you paste the object into other applications, the object retains its data.

Note: Cut, Copy, and Paste cannot be applied to subreports.

To cut, copy, or paste an object

Several methods can be used:1. Right-click the object (or the main object in multiple selections) and select the applicable

operation from the shortcut menu.

2. Click Edit ➤ Cut/Copy/Paste.Alternately, you can press Ctrl-X or Shift-Delete for Cut, Ctrl-C or Ctrl-Insert for Copy, orCtrl-V or Shift-Insert for Paste.

Tip: If you select a single object, you can copy it easily by clicking it, holding down theControl key, and dragging it to the desired location.

57Creating a Report—Learner’s Guide

Page 74: BOC310 en Col91 FV Part Ltr Marca

Formatting objectsOnce you have placed fields or objects on your report, youmaywant to change their appearance.Crystal Reports enables you to change many of the attributes such as font, font size, font color,border lines, and underline through the Formatting toolbar and the Format Editor.

After completing this unit, you will be able to:

• Format fields using the Formatting toolbar and the Format Editor• Lock an object’s format• Use text objects

Formatting fields using the Formatting toolbar

The Formatting toolbar includes such options as font formatting, text formatting and alignment,and highlighting. Database fields can be formatted to printwith the colors, fonts, and attributesthat you prefer. These fields can also be formatted to change the way the data displays on yourreport. For example, you might prefer your numbers to be printed with two decimal placesand your dates to be in the North American format. These attributes can be combined to makeyour reports presentation quality.

To format fields using the Formatting toolbar

1. Select the object you want to format.

2. Click the appropriate formatting button on the Formatting toolbar.

Formatting fields using the Format Editor

Using the Format Editor is another, more complex method of formatting. Some of the morefrequently used features of the Format Editor are the options listed on these tabs:• Common• Border• Font• Number

Common tab of the Format Editor

On the Common tab, you can suppress the field, keep the field together if a record spans morethan one page, control borders of the field, limit the number of lines the field can print, rotateand align text, add tooltip text, and lock the size and position of the selected object.

Fundamentals of Report Design—Learner’s Guide58

Page 75: BOC310 en Col91 FV Part Ltr Marca

Border tab of the Format Editor

On the Border tab, you can select line styles, drop shadows, and the color for the border andthe background. Clicking Background opens a second color selection list for you to choose afill color for the text object.

59Creating a Report—Learner’s Guide

Page 76: BOC310 en Col91 FV Part Ltr Marca

Font tab of the Format Editor

On the Font tab, your options include the changing the font, style, size, and color. You can alsoadd a strikeout (a line through text) and underline effects. The sample box shows you the resultsof your choices.

Fundamentals of Report Design—Learner’s Guide60

Page 77: BOC310 en Col91 FV Part Ltr Marca

Tip: Many of the attributes you see in the Format Editor have the formula buttons next tothem. These buttons are used for conditional formatting, or applying a condition to a specificformat using a formula.

Number tab of the Format Editor

If you select a numeric field to format, the Format Editor offers these options on theNumbertab.

61Creating a Report—Learner’s Guide

Page 78: BOC310 en Col91 FV Part Ltr Marca

• System Default Number Format

This option checks the settings in your Windows control panel and uses those settings foryour numeric fields.

• Currency symbol area

This option enables you to display a currency symbol and its type, if applicable.

• Customize

Under the Customize button, you can set various options:○ Suppress if Zero

This option functions similar to a spreadsheet. If the value to be printed is “0” (zero), thenno value is shown.○ Decimals

This option enables you to include decimals or not.○ Rounding

This option enables you to round a number to the specified number of decimal places or tothe nearest whole number if no number of decimal place is indicated.○ Negatives

This option offers several different ways to display negative values.○ Decimal Separator

Fundamentals of Report Design—Learner’s Guide62

Page 79: BOC310 en Col91 FV Part Ltr Marca

This option enables you to specify what character to print as a decimal separator.○ Thousands Separator

This option enables you to turn the thousands separator on and off. The input box allowsyou to specify what that separator is.○ Leading Zero

This option enables you to turn leading zeroes on and off as well as specify the format.

To change the attributes of a field

1. Right-click a field and select Format Field from the shortcut menu.The Format Editor opens.

The tab that is displayed depends on the type of field selected. For example, if a numberfield is chosen, then theNumber tab is displayed.

2. Select the options on the appropriate tab that you want to apply.

3. ClickOK.

Locking an object’s format

Similar to locking an object’s position and size, you can also lock the format of an object so itcan’t be changed accidentally.

To lock the format of an object

1. Select the object.

2. Click Lock Format on the Formatting toolbar.

Using text objects

Text objects are containers that hold information giving you flexibility and control wheninserting text into your report. A text object can contain a character, a word, or a paragraph.Database fields and formula fields can be embedded inside text objects along with other text.For example, youmaywant to combine the first and last name of customers fromyour databaseon a mailing label.

Text objects and the elements inside them can then be independently formatted with fonts,color, tabs, and so on.

Suppose youwant to put a title on your report. To do this, you need to create a text object. Textobjects have some word processing capabilities, allowing you to type text as well as set, move,and use tabs. You can create left, center, right, and decimal align tabs inside text objects.

63Creating a Report—Learner’s Guide

Page 80: BOC310 en Col91 FV Part Ltr Marca

Tip: When you have completed any editing changes, do not press Enter to end the process. Thisaction inserts a return inside the text object. Click outside the text object to finish the editing process.If youwant to add a new paragraph in a text object, then press Enter to move to the next paragraph.

To insert a text object

1. Click Insert Text Object on the Insert Tools toolbar.

You can also click Insert ➤ Text Object.

A new, empty text object attaches to your cursor.

2. Position the text object where you want it on your report, and then click to release.

The text object opens on your report with its own ruler line. The cursor flashes inside thetext object at the insertion point.

3. Enter the text you want to print on your report inside the text box.

4. Click outside the text object or click Esc to cancel the selection.

To move or reposition a text object

1. When working with text objects, click the border once to select them.Once selected, handles appear around the object.

2. Click the text object to move it to a new position or resize it.This functionality is called the Move/Resize mode.

To edit the text inside a text object

1. Double-click the object.

The insertion point flashes inside the text object to indicate the position where inserted textwill appear.

You can also right-click the text object and select Edit Text Object from the shortcut menu.

A ruler line opens above or below the text object. This line indicates you are inside the textobject, ready to edit. You can also set tabs and indents similar to the functionality in a wordprocessor.

2. Edit the text inside the text object.

3. Click outside the text object to cancel the selection.The object now appears with four corners surrounding the text inside.

Fundamentals of Report Design—Learner’s Guide64

Page 81: BOC310 en Col91 FV Part Ltr Marca

Tip: The place where the ruler line appears depends on the position of the text object. Ifthe text object is too close to the top of the screen to add a ruler line, it will appear below.

Activity: Positioning, sizing, and formatting objects

Objective

• Position, size, and format different fields and objects on a report.

Instructions

1. Open the previous report, Creating a report.rpt.

Tip: Remember to make changes in theDesign tab because you’re working withplaceholders, not the actual data, which speeds up the report creation process.

2. Rearrange the columns in this order using the guidelines: Region, City, Customer Name,Order Date, Order Amount, and Order ID.

3. Resize the fields and column headings to accommodate the data, if required.

4. Format theOrder Amount field to print with no decimal places and with no dollar signs($).

5. Format the Region field and column heading to be centered.

6. Use the Report Explorer to format theOrder Date to print with no time portion using theFormat Editor.

7. Change the color of all column headings to print bold and in blue. Use Select All SectionObjects.

8. Create a text object that will print “Customers & Orders Report” as the title in the ReportHeader.

9. Center the title and increase the font size of the text to 20 point.

10.Add a single border and a drop shadow to the title.

11.Change the color of the text inside the text object to Navy.

12.Make sure the title prints in the center of your page.

13.Save the report as Positioning+ objects.rpt.

14.Add this report to the folder in theWorkbench.

65Creating a Report—Learner’s Guide

Page 82: BOC310 en Col91 FV Part Ltr Marca

Your report should look similar to this example.

Fundamentals of Report Design—Learner’s Guide66

Page 83: BOC310 en Col91 FV Part Ltr Marca

Quiz: Creating a report1. What is the difference between using theDesign tab and Preview tab?

2. What is the difference between using Print Preview and Refresh?

3. What objects can be stored in the repository?

4. What is theWorkbench?

5. How do you select multiple report objects?

67Creating a Report—Learner’s Guide

Page 84: BOC310 en Col91 FV Part Ltr Marca

Lesson summaryAfter completing this lesson, you are now able to:

• Create a report• Add tables• Describe the design environment• Insert objects on a report• Preview a report• Save a report• Position and size objects• Format objects

Fundamentals of Report Design—Learner’s Guide68

Page 85: BOC310 en Col91 FV Part Ltr Marca

Lesson 3Selecting Records

Lesson introductionRarely will you want a listing of every record in your database. Most often you are interestedin only a select set of records, as in sales for a particular region or inventory for a category ofproducts.

After completing this lesson, you will be able to:

• Define the Select Expert• Determine the criteria for record selection• Understand saved and refreshed data• Apply record selection• Apply additional record selection criteria• Modify record selection• Apply time-based record selection

69Selecting Records—Learner’s Guide

Page 86: BOC310 en Col91 FV Part Ltr Marca

Defining the Select ExpertYou can filter or select the records youwant to see included on your report in the Select Expert.

After completing this unit, you will be able to:

• Explain the functionality of the Select Expert and its components• Define the features of the Select Expert

Using the Select Expert

The report you created previously will print all records in your database. Often, however, youwant to restrict the records printed for a particular set. For example, in the Xtreme databasethat ships with Crystal Reports, a number of distributors are listed. You may want to reporton only those in North America or only those who sold more than $30,000 last year.

To do this, you set the record selection of your report to include only the data youwant in yourreport.

To activate the Select Expert

To activate the Select Expert, you can:1. Click Select Expert on the Expert Tools toolbar.

2. Choose Report ➤ Select Expert from the menu.

3. If the field you want to set record selection on is on your report, right-click that field andchoose Select Expert from the shortcut menu.The Select Expert opens automatically for the field you select. You are not presented witha pick list of fields.

If you have not selected a field by clicking it to make it active before using one of thesemethods, a dialog box opens, displaying the fields.

Fundamentals of Report Design—Learner’s Guide70

Page 87: BOC310 en Col91 FV Part Ltr Marca

Tip: Your record selection criterion does not have to be based on a field in your report. Youcan choose any field from the database as a basis for record selection.

Once you have indicated the field you want to set the record selection on and have clickedOK, the Select Expert opens.

The Select Expert’s features

In addition to theNew andDelete buttons, the Select Expert contains several function buttonsincluding:• OK: This option accepts any changes you have made and closes the dialog box; the report

is then updated to reflect those changes.• Cancel: This option closes the dialog box ignoring any changes youmadewhile in the dialog

box; the report is not affected.• Help: This option opens the Crystal Reports onlineHelp.• Browse: This option opens a Fields dialog box that shows a sample of values from the

database.• Show Formula: This option expands the Select Expert to include a display of the formula

created.

71Selecting Records—Learner’s Guide

Page 88: BOC310 en Col91 FV Part Ltr Marca

Determining the criteria for record selectionSetting the filters or options limits the number of records, which are then displayed in thereport.

After completing this unit, you will be able to:

• Describe the options that define record selection criteria• Change record selection to be case insensitive

Defining record selection

The first step in record selection is to define your criteria for selection. For example, do youwant to focus on one city or state, or are you interested in specific regions. Maybe a date rangeor all records below a particular value will work best.

Using the drop-down list, you can build selection criteria that meet your needs. Depending onthe field you select, the available options in the drop-down list are:• is any value

This option selects all records, meaning no selection at all.

• is equal to

This option enables you to specify one specific value as the criteria, so that only matchingrecords are included on the report; for example, only records from California (CA).

• is one of

This option enables you to specify a series of values as the criteria, so that only recordsmatching one of these will be included on the report; for example, only records from CA,BC, or NY.

• is not one of

This option enables you to exclude a series of values as the criteria, so that those matchingrecords will be excluded on the report; for example, not records from CA, BC, or NY.

• is greater than or less than

This option enables you to indicate a specific value that records must be above or below tobe included on the report; for example, only records with sales greater than or over $50,000for the last year.

• is greater than or equal to or less than or equal to

This option enables you to include all records in which the linked field value is above orbelow (or equal to) to be included on the report; for example, only records with sales thatare the same amount (that is, $50,000) or greater than or over $50,000 for the last year.

• is between

This option enables you to select records that have a value falling between or matching oneof the two specified values; is inclusive and includes the end values; for example, onlyrecords with last year’s sales between $10,000 and $20,000, including $10,000 and $20,000.

Fundamentals of Report Design—Learner’s Guide72

Page 89: BOC310 en Col91 FV Part Ltr Marca

• is not between

This option enables you to exclude records that have a value falling between or matchingone of the two specified values; is inclusive and excludes the end values; for example,excludes records with last year’s sales between $10,000 and $20,000, including $10,000 and$20,000.

• starts with

This option enables you to indicate character(s) or value(s) that each data field must beginwith in order to pass the selection criteria; for example, only customers whose names beginwith the letter “A.”

• does not start with

This option enables you to indicate character(s) or value(s) that each data field does notbegin with in order to pass the selection criteria; for example, no customers whose namesbegin with the letter “A.”

• is like

This option permits DOS wildcard characters (? and *) to specify criteria that must be met;for example, crystal, comical, and critical could all be selected using “is like c*.”

• is not like

This option permits DOS wildcard characters (? and *) to specify criteria that must beexcluded; for example, using “is not like c*” would exclude crystal, comical, and critical.

• in the period

This option enables you to specify a date range in which records must fall in order to beincluded on the report and is only available if a date field is chosen; with this option, a scrolllist of all Crystal Reports date ranges is made available.

• is not in the period

This option enables you to specify a date range in which records must not fall in order tobe included on the report and is only available if a date field is chosen; with this option, ascroll list of all Crystal Reports date ranges is made available.

• formula

This option expands the dialog box where you enter your criteria.

The Select Expert dialog box defaults to “any value.” If you enter a choice other than “anyvalue” in the drop-down list box, a second drop-down list appears that contains some sampledata from your database. You can choose values directly from the drop-down list or manuallyenter the value at the cursor prompt.

Note: If you are familiar with the Crystal formula language, you can enter your formula here.You can click Show Formula>>> to view the formula(s), if any, used by Crystal Reports. Youcan also activate the Formula Editor from this extended window andmodify this formula. Forexample, you may want only the records in which profits are over a certain percentage. Oncethe percentage is calculated, the record selection decides whether or not to allow the record topass.

73Selecting Records—Learner’s Guide

Page 90: BOC310 en Col91 FV Part Ltr Marca

Changing record selection to be case insensitive

If you are not confident that data entry was consistent and California could have been enteredas “CA,” “ca”, Ca,” or even “cA” in your database, you will want to ensure that your recordselection statement is case insensitive. Otherwise, you would not filter out all the records fromCalifornia.

To change record selection to case insensitive in a report

1. Click File ➤ Report Options.The Report Options dialog box appears.

2. Select theDatabase Server is Case Insensitive check box to control the case sensitivity ofthe record selection formula(s) in your report.

3. ClickOK.

To change record selection to case insensitive globally

1. Click File ➤ Options.

Fundamentals of Report Design—Learner’s Guide74

Page 91: BOC310 en Col91 FV Part Ltr Marca

2. On theDatabase tab, select theDatabase Server is Case Insensitive check box to controlthe case sensitivity of the record selection formula(s) in all reports.

3. ClickOK.

75Selecting Records—Learner’s Guide

Page 92: BOC310 en Col91 FV Part Ltr Marca

Understanding saved and refreshed dataIn Crystal Reports, you have the option to use data that is saved to your local machine or usedata that is directly taken from the data source.

After completing this unit, you will be able to:

• Describe the difference between saved and refreshed data

Saving data with a report

Reports with saved data are useful for dealing with data that isn't continually updated. Whenusers navigate through reportswith saved data, and drill down for details on columns or charts,they don't access the database server directly; instead, they access the saved data. Consequently,reports with saved data not only minimize data transfer over the network, but also lighten thedatabase server's workload.

You can schedule these reportswithin BusinessObjects Enterprise, so they automatically refreshfrom the database on a predetermined basis. For example, if your sales database is only updatedonce a day, or once a week, then you can run the report on a similar schedule and save it withdata. Sales representatives then always have access to current sales data, but they aren't hittingthe database every time they open a report. Alternatively, you can refresh reports with saveddata on an as-needed basis.

Saved data is discarded and refreshed when you perform any of these tasks in a report:• Select the Refresh command.• Change your database logon.• Change the report's parameters.• Add a new field that doesn't exist in the saved data.• Drill down in a reportwherePerformGroupingOnServer is selected and the details section

is suppressed.• Verify the database—if the database structure has changed substantially.• Change the linking parameter on a subreport (the subreport is refreshed).• Change the order of groups (only for reports in the Report Application Server).

To save data with a report

1. Click File ➤ Save Data with Report.

2. Save the report.

Note: If the Save Data with Report option is checked, then it’s already active.

Refreshing data in a report

When you refresh a report that doesn't have saved data, Crystal Reports retrieves data fromthe database; otherwise, the program discards the report's saved data and retrieves new data.

Fundamentals of Report Design—Learner’s Guide76

Page 93: BOC310 en Col91 FV Part Ltr Marca

By design, Crystal Reports only retrieves data when necessary.When you preview your reportin the Preview tab, print the report, or export it to a file, the program runs your report andretrieves the required data. Once you areworkingwith the data in the Preview tab, the programruns the report again and retrieves fresh data if you:• Add fields to the report after the report was run.• Add a formula that references a field that was not in the report when you ran it the first

time.• Expand your record selection criteria to include more records than were needed when you

first ran the report.

Aside from these circumstances, the program will not automatically refresh a report.

However, there may be times when you want to retrieve new data for the report. For example,you may have created a report several days earlier and you want to see it run with the mostcurrent data. Refreshing report data is intended for times such as this.

To refresh data

1. Click Refresh on theNavigation Tools toolbar.Alternately, click Report ➤ Refresh Report Data or press F5 on the keyboard.

The program runs your report and retrieves the required data.

77Selecting Records—Learner’s Guide

Page 94: BOC310 en Col91 FV Part Ltr Marca

Applying record selectionWhen you apply a filter to your report, limiting the number of records returned, you are settingthe selection criteria.

After completing this unit, you will be able to:

• Set selection criteria

Setting selection criteria

Record selection is determined by the selection criteria. Applying record selection to your reportallows you to limit or restrict the records that are displayed.

To apply record selection

1. Click Select Expert.

The Choose Field dialog box opens.

2. Choose the field you want to use.

3. ClickOK.

ClickingOK creates a tab in the Select Expert for that field.

4. From the drop-down list, choose the criteria method.

5. Enter the values to be used by the criteria in the second drop-down list.

You can pick from the list of samples or type in your own choices.

6. ClickOK.

Fundamentals of Report Design—Learner’s Guide78

Page 95: BOC310 en Col91 FV Part Ltr Marca

Activity: Applying record selection

Objective

• Select only the records you want to see included on your report.

Instructions

1. Open the Positioning+ objects.rpt that you created in the previous lesson.

2. Set record selection so that only companies from British Columbia (BC), Ohio (OH),Pennsylvania (PA), and California (CA) appear on the report.

3. Save the report as Applying record selection.rpt.

4. Add the report into the folder in theWorkbench.Your report should look similar to this example.

79Selecting Records—Learner’s Guide

Page 96: BOC310 en Col91 FV Part Ltr Marca

Setting additional criteriaYou can also addmultiple criteria to record selection,which produces evenmore refined results.

After completing this unit, you will be able to:

• Set additional record selection criteria

Setting additional record selection criteria

Often, your report will require more than one selection criteria. For example, you may wantto select from a list of clients in certain regions who sold over $30,000.

To do this, you would create a record selection using the appropriate date and, if needed,formula fields in the Select Expert. Crystal Reports reads the date fromyour system anddisplaysthe appropriate data each time the report is refreshed.

For example, you need a report that shows each staff member that had been hired between acertain period. The easiest method is to use the "is between" option in the Select Expert.

To do this, you need to create a report showing staff names and their hire dates. If you wantto see all the employees hired in a specific year, use the "is between" option and enter the firstday of the first month of the year in the top drop-down list and the last day of the last monthof the year in the bottom drop-down list. This record selection will return the records of allemployees who were hired in that year.

Another method is to use "is in the period." This method provides you with options to selecta predetermined start and finish date for the period of time you request.

To set additional selection criteria

1. From the report, activate the Select Expert.

Remember that if the field youwant to set criteria on is included in the report, you can selectit first then activate the Select Expert.

2. Click theNew tab.

The Choose Field dialog box opens, prompting you to select a field for record selection.

3. Select the desired field.

4. ClickOK.

The Select Expert dialog box opens, ready for you to set the criteria as you did for the firstfield.

5. Set the criteria for the field.

6. ClickOK.

These steps ensure that only the fields that meet all criteria are included on the report.

Fundamentals of Report Design—Learner’s Guide80

Page 97: BOC310 en Col91 FV Part Ltr Marca

Activity: Setting additional selection criteria

Objective

• Refine the record selection by adding additional criteria.

Instructions

1. Open the Applying record selection.rpt from the previous activity.

2. Add a new criterion to your record selection to include all companies with Order Amountover $1000.

Note: With this step you are narrowing the selection even further. Your report should nowcontain only those records that meet both selection criteria.

3. Save the report as Setting additional selection criteria.rpt.

4. Add the report into the folder in theWorkbench.Your report should look similar to this example.

81Selecting Records—Learner’s Guide

Page 98: BOC310 en Col91 FV Part Ltr Marca

Modifying record selectionYou can change the record selection filters or modify the record selection’s formula.

After completing this unit, you will be able to:

• Modify existing record selection• Modify a record selection formula

Modifying existing record selection

Sometimes you may need to modify the record selection in order to produce the results youintended.

To modify existing record selection criteria

1. From theDesign or Preview tab, make sure no fields are selected, and then click SelectExpert.The Select Expert opens.

2. Modify the selection.

3. ClickOK to apply the changes.

Note: You can remove the record selection by clicking theDelete button in theSelect Expert.Remember that you are only removing the record selection, not the records.

Modifying a record selection formula

You can set up different types of record selection requests without any previous knowledgeof the formula language using the values listed in the Select Expert. However, there may betimes when you want to modify the actual formula of the record selection request.

By default, Crystal Reports links multiple selection criteria with an “and” statement. Forexample, selecting the state equal to CA or BC and company sales over $30,000 would resultin Californian or British Columbian companies that sold over $30,000.

For example, using the record selection formula that shows only BC and CA companies withno other selection criteria, the formula in the Select Expertwould look like this:

Fundamentals of Report Design—Learner’s Guide82

Page 99: BOC310 en Col91 FV Part Ltr Marca

Using the record selection formula that shows only BC and CA companies with no otherselection criteria, the result set would look like this:

If you wanted to show BC and CA companies with sales over $30,000, the record selectionformula with “and” would look like this:

83Selecting Records—Learner’s Guide

Page 100: BOC310 en Col91 FV Part Ltr Marca

This record selection would result in:

If you wanted to show BC and CA companies or companies with sales over $30,000, the recordselection formula with “or” would look like this:

Fundamentals of Report Design—Learner’s Guide84

Page 101: BOC310 en Col91 FV Part Ltr Marca

The selection formula with “or” would result in:

Because you are asking for companies in BC and CA or companies with sales over $30,000, theformula gives back all companies in the regions regardless of their last year’s sales.

To change the formula to modify record selection

1. Open the Select Expert and click Show Formula.

85Selecting Records—Learner’s Guide

Page 102: BOC310 en Col91 FV Part Ltr Marca

The formula is shown in the lower panel.

2. Remove the word “and” and replace it with “or.”

3. ClickOKwhen done.The record selection in this example will result in a listing of companies that sold over$30,000 or companies in British Columbia (BC) or California (CA).

Activity: Refining the record selection

Objective

• Modify the record selection to further refine the record selection.

Instructions

1. Open the Setting additional selection criteria.rpt from the previous activity.

2. Select the region to be only BC and CA.

3. Change your record selection criteria from “and” to “or.”

4. Refresh the report to see the difference in the data displayed.

5. Change your record selection criteria back to “and.”

6. Refresh the report to see the difference in the data displayed.

7. Save the report as Refining the record selection.rpt.

8. Add the report into the folder in theWorkbench.

Fundamentals of Report Design—Learner’s Guide86

Page 103: BOC310 en Col91 FV Part Ltr Marca

Your report should look similar to this example.

87Selecting Records—Learner’s Guide

Page 104: BOC310 en Col91 FV Part Ltr Marca

Applying time-based record selectionSetting a time-based record selection is useful when you want to determine results based on acertain date or time range. For example, you may want to find out which customers boughtover $10,000 in product from you in Q1 of your fiscal year.

After completing this unit, you will be able to:

• Set record selection criteria based on a date

Setting record selection based on a date

Often, you will want to select records based on a date field. You may want to see all accountsthat have not been accessed in the past year, or to show all sales reps that have placed five ormore orders in the past month.

To do this, you would create a record selection using the appropriate date and, if needed,formula fields in theSelect Expert. Crystal Reports reads the date fromyour systemanddisplaysthe appropriate data each time the report is refreshed.

For example, you need a report that shows each staff member that had been hired between acertain period. The easiest method is to use the “is between” option in the Select Expert.

Tip: Watch out for “is between” and “is less than” when entering dates. If no time is entered, theprogram assumes you meant “midnight” and you might miss an entire day’s results.

To do this, you need to create a report showing staff names and their hire dates. If you wantto see all the employees hired in a specific year, use the “is between” option and enter the firstday of the first month of the year in the top drop-down list and the last day of the last monthof the year in the bottom drop-down list. This record selection will return the records of allemployees who were hired in that year.

Another method is to use “is in the period.” This method provides you with options to selecta predetermined start and finish date for the period of time you request.

Fundamentals of Report Design—Learner’s Guide88

Page 105: BOC310 en Col91 FV Part Ltr Marca

To apply time-based record selection

1. Right-click the date field and select the Select Expert from the shortcut menu.The Select Expert opens.

2. In the Select Expert, click the option you want to use from the first drop-down list.

3. Depending on the option selected, enter the appropriate dates.

4. ClickOKwhen you are finished.

Activity: Applying a time-based record selection

Objective

• Create a record selection based on a date.

Instructions

1. Open the Refining the record selection.rpt from the previous activity.

2. Create a record selection based on the Order Date to show records for orders placed in 2004only.

3. Preview the report. (Use saved data.)Note the number of records returned with the record selection applied.

4. Save the report as Applying time-based record selection.rpt.

5. Add the report into the folder in theWorkbench.

89Selecting Records—Learner’s Guide

Page 106: BOC310 en Col91 FV Part Ltr Marca

Your report should look similar to this example.

Fundamentals of Report Design—Learner’s Guide90

Page 107: BOC310 en Col91 FV Part Ltr Marca

Quiz: Selecting records1. What tool is used for filtering or selecting records in Crystal Reports?

2. When you want to see new data from the database after modifying the record selection,what option would you use?

3. Why would you want to ensure your record selection is case insensitive?

4. When would you use a time-based record selection?

5. When youwant to refresh the data on your report, what are the threemethods you can use?

91Selecting Records—Learner’s Guide

Page 108: BOC310 en Col91 FV Part Ltr Marca

Lesson summaryAfter completing this lesson, you are now able to:

• Define the Select Expert• Determine the criteria for record selection• Understand saved and refreshed data• Apply record selection• Apply additional record selection criteria• Modify record selection• Apply time-based record selection

Fundamentals of Report Design—Learner’s Guide92

Page 109: BOC310 en Col91 FV Part Ltr Marca

Lesson 4Organizing Data on a Report

Lesson introductionOnce you have selected the fields on which you want to report from your database and haveplaced them on the report, you can now organize those records in a meaningful way andperform basic calculations.

After completing this lesson, you will be able to:

• Sort records• Group records• Summarize data

93Organizing Data on a Report—Learner’s Guide

Page 110: BOC310 en Col91 FV Part Ltr Marca

Sorting recordsUsing a record sort order enables you to list the records in a particular order, making the reportmore meaningful.

After completing this unit, you will be able to:

• Apply a sort order to records

Applying a sort order to records

Once you have selected the records to print and positioned them on your report, youwill likelywant to sort them in ameaningful sequence. For example, youmaywant to sort in alphabeticalorder or fromhighest to lowest sales. If you do not specify a sort order, Crystal Reports displaysthe records in their natural order, that is, the order in which they appear in your database.

Each field in the Sort Fields list can be assigned a sort direction in ascending or descendingorder independently. For example, you could sort your list by Region in alphabetical order,then by company in descending order of Last Year Sales.

To apply a sort order to records

1. Click the Record Sort Expert button on the Expert Tools toolbar.

You can also click Report ➤ Record Sort Expert .

The Record Sort Order dialog box opens.

All fields currently on your report are listed in the Report Fields list on the left.

2. Add the fields from the Report Fields list to the Sort Fields list on the right using > (Add).

3. Assign an Ascending orDescending order individually in the Sort Direction area.

Fundamentals of Report Design—Learner’s Guide94

Page 111: BOC310 en Col91 FV Part Ltr Marca

The selection is indicated with an A (ascending) or D (descending), depending on whichsort order was selected. In a multiple-level sort, not all sorts have to be the same (ascendingor descending).

4. ClickOK, and then preview your report.

Tip: The default is Ascending for each field as it is added to the Sort Fields list. ClickDescending to change the sort direction.

To remove a field from the Sort Fields list

1. Select the field and click < (Remove).You can also double-click the field.

To reorder fields from the Sort Fields list

1. Select the field and click the Up orDown arrow above the Sort Fields area.

Tip: You can also click a field and drag it into the sort position you require.

Using sort controls

You may want to design your report so that users can modify a sort field or sort directionwithout refreshing information from the database. You can do this using a Sort Control.

A Sort Control is useful for several reasons:

• It allows users to sort report data for further analysis without leaving the canvas of thereport.

• It eliminates processing demand on the database.• It reduces the time users spend waiting for data to be sorted.• It allows users to sort fields in the report even if they do not have a connection or rights to

access the database at the time of viewing.

When planning to include aSort Control in your report, it is important to consider the followingpoints:• Sort controls apply across an entire record set; you cannot sort only one group.• Sort controls cannot be used in sub-reports.• Sort controls cannot be created within a cross-tab or an OLAP grid.• The use of sort controls causes any open drill-down tabs to close (a warning prompt alerts

users).

To create a sort control

1. Once the data is grouped, on the Reportmenu, click Record Sort Expert.

The Record Sort Expert appears.

95Organizing Data on a Report—Learner’s Guide

Page 112: BOC310 en Col91 FV Part Ltr Marca

Note: Sort fields that beginwith "Group" specify that the sort was done automaticallywhenthe data was grouped.

2. Highlight the fields that you want to sort by and click the > arrow to add them to the SortFields list.The order of the fields in the Sort Fields list is the initial order by which data is sorted.

Note: To enable a Sort Control on a field, that field must be included in the Sort Fields list.

3. ClickOKwhen finished.

4. Create your Sort Control:

• If you want to use an existing text object:1. On your report, right-click the text object that youwould like to use as a Sort Control.

2. Click Bind Sort Control.

The Sort Control dialog box appears.

3. Select a sort field and clickOK.

• If you want to add a new text object:1. On the Insertmenu, click Sort Control.

2. Select a sort field and clickOK.

3. Click and drag your cursor to the report location where you would like to insert theSort Control.

4. Enter a name for the new Sort Control, and click outside the text object to completethe process.

5. Repeat Step 4 for any other sort controls you want to create.

Users can sort the fields you have selected by clicking the sort arrows that appear beside thetext object. The report promotes the selected field temporarily to the top of the sort order.When

Fundamentals of Report Design—Learner’s Guide96

Page 113: BOC310 en Col91 FV Part Ltr Marca

a second Sort Control is used, the first is returned to its original position in the sort order andthe second is promoted to the top sort.

Note: Grouping hierarchy is not affected by Sort Control.

To remove a sort control

1. Right-click the text object that contains the existing Sort Control.

2. Click Bind Sort Control.The Sort Control dialog box appears.

3. Click < Not Interactive >.

4. ClickOK to return to your report.

The Sort Control is removed from the report.

Activity: Applying sorting options

Objective

• Sort records to list the records in a particular order, making the report more meaningful.

Instructions

1. Open the Applying time-based record selection.rpt from the previous lesson.

2. Sort the records in your report to print in ascending order by Region and City thendescending order by Order Date.

3. Preview the report.

4. Create a sort control on Region.Notice how the regions change based on the sort direction chosen.

5. Remove the sort control on Region.

6. Save the report as Applying sorting options.rpt.

7. Add the report into the folder in theWorkbench.

97Organizing Data on a Report—Learner’s Guide

Page 114: BOC310 en Col91 FV Part Ltr Marca

Your report should look similar to this example.

Fundamentals of Report Design—Learner’s Guide98

Page 115: BOC310 en Col91 FV Part Ltr Marca

Grouping recordsBy grouping records intomeaningful sequences, you create amore readable and usable report.

After completing this unit, you will be able to:

• Create groups• Modify groups• Create nested and multiple groups• Reorder groups• Add a specified order group• Group on time-based data

Creating groups

Even though your records are now sorted, youmaywant to break data intomeaningful groups.For example, you may want all the customers from one region together in one group: allCalifornia customers together, all BC customers together, and so on.

Crystal Reports can then summarize the information in each group. You can group informationbased on report fields, on database fields that are not in the report, and on formula fields. Thisgrouping cannot be achieved with multi-level sorts since it is one long list; there can only beone summary using multi-level sorts.

When you group records, you add new areas to your report. These new areas are visible in theleft margin of the Designwindow. Once you have created a group, a GroupHeader andGroupFooter surround the Details area. Each group you create has its own header and footer. Also,when you insert a group, the Group #n Name field is automatically created in the GroupHeader.

Navigating using the Preview Panel

The Preview Panel appears in the left margin of the Previewwindow. It functions like adirectory tree with a heading for each group in your report, with the ability to expand thegroup to see further levels of grouping.

To expand a group in the Preview Panel

1. Select the Toggle Preview Panel icon in the Standard toolbar.

2. Click the plus sign (+) icon next to the group name.Clicking the minus sign (-) collapses the group.

If your report has only one level of grouping, no plus or minus icons will appear beside thegroup names.

99Organizing Data on a Report—Learner’s Guide

Page 116: BOC310 en Col91 FV Part Ltr Marca

Navigating in the report using drill-down

In the Preview window, you can also drill down on the various groups to obtain informationfor the specific group.

To drill down on group headers

1. Double-click a group on the actual report.An extra tab opens beside theDesign and Preview tabs, displaying the information for thatgroup.

2. Click the Close View button beside the page controls to close the drill-down group tab.

Applying sort order options when grouping

You apply sort order options when grouping in the Insert Group dialog box.

The options for sorting your groups are:• in ascending order

A to Z, 1 to 9, lowest to highest, and so on.

• in descending order

Z to A, 9 to 1, highest to lowest, and so on.

• in specified order

You can create your own group based on data other than the fields in the database. Forexample, you could create groups based on geographical areas or sales territories and namethem accordingly such as Western Region, Eastern Region, Central Region, and so on.

• in original order

Fundamentals of Report Design—Learner’s Guide100

Page 117: BOC310 en Col91 FV Part Ltr Marca

This option leaves the records in the same order as they were stored in the database.

• Use a Formula as Group Sort Order

This option enables you to use a formula to specify the sort order of groups.

TheOptions tab in the Insert Group dialog box lists the other types of grouping optionsavailable.

These options include:• Customize Group Name Field

The name of the group can be customized to suit your needs. You can choose froman existingfield or build a formula that displays a different group name.

• Keep Group Together

This option prevents a group frombeing split across pages and forces groups to stay together.If there is enough room to print all records from a group on the current page, then all therecords will print on that page. If not, they will be printed on the next page.

• Repeat Group Header On Each New Page

The name of the group in the Group Header using the Group Name Field is printed on thereport. If, for example, you had grouped your report by region, the region name wouldprint just above the first record of that region.

If the group contains so many records that the group needs to span over more than one page,this option forces the Group Name Field to repeat on each new page for a particular group.

Each group generated by the report prints a group header before printing the Details areainformation. Group names are commonly found in the group header. After the last record ofthe group has printed, the group footer prints. Summary information about the group iscommonly found in the group footer.

101Organizing Data on a Report—Learner’s Guide

Page 118: BOC310 en Col91 FV Part Ltr Marca

Note: If you do not want to include the group namewith the group, you can clear the Insert GroupName with Group option on the Layout tab in the Options dialog box under the File menu.

Tip: Grouping overrides record sort, so check your grouping and sorting options after refreshinga report to ensure the results returned are still appropriate.

To insert a group

1. Click Insert ➤ Group.

You can also click the Insert Group button on the Insert Tools toolbar.

The Insert Group dialog box opens.

2. In the first drop-down list, select the field you want to group on.You have a new group for every change in this value.

3. Select a sorting option from the second drop-down list.

4. When you have finished defining your group(s), clickOK.The dialog box closes and returns to the report.

5. Preview your report.

To format a group

1. Right-click the group name and select Format Field from the shortcut menu.A dialog box opens, showing the options associated with the group. For example, if youclicked a date field group name to format, you would see all the formatting options fordates. Options exist for number/currency and text fields as well.

2. Format the field.

Fundamentals of Report Design—Learner’s Guide102

Page 119: BOC310 en Col91 FV Part Ltr Marca

3. ClickOK.

Tip: Hover your cursor over a group in the grey area to display the name of the group.

Modifying groups

Once you have created groups on your report, you may find it necessary to modify them. Forexample, perhaps you grouped by region and would now like to group by country. You coulddelete the region group and add a new group, or you could redefine the existing group. Orperhaps you want to add a second level of grouping to have your records grouped by countrythen by region.

Tip: You will find it easier to work with your groups from the Design tab where you can see thegroup names and boundaries.

Changing the definition of a group

You may create a group that later you want to remove because of changing circumstances orchanging information needs. If your needs change, you can modify the group. For example,you created a report that was grouped by region, but now prefer to have the informationgrouped by country. You do not need to remove the existing group and replace it with a newone; you can redefine the existing group.

103Organizing Data on a Report—Learner’s Guide

Page 120: BOC310 en Col91 FV Part Ltr Marca

To change the definition of a group

1. In theDesignwindow, right-click the gray area of the Group Header or Group Footer andselect Change Group from the shortcut menu.The Change Group Options dialog box opens.

You can change the field the group is based on, the order of the group, or the Keep GroupTogether and Repeat Group Header On Each New Page options.

2. Make your changes on the Common orOptions tabs.

3. ClickOK.

Deleting groups

You may create a group that later you want to remove because of changing circumstances orchanging information needs.

Fundamentals of Report Design—Learner’s Guide104

Page 121: BOC310 en Col91 FV Part Ltr Marca

To delete a group

1. Right-click in the gray area over the Group Header or Group Footer of the group you wantto delete, and then selectDelete Group from the shortcut menu.

The group section is deleted from the report.

Activity: Creating and modifying groups

Objective

• Create and modify groups based on specific selection criteria.

Instructions

1. Open the Applying sorting options.rpt from the previous activity.

2. Remove the selection criteria for records with Order Amount being greater than $1000.

3. Refresh the report to view the results.

4. Group the records on your report by City and set the group sort order to be ascending inalphabetical order.

5. Modify the existing group to be based on Region not City.

6. Remove the Region field and column heading from your report and reposition fields ifneeded.

105Organizing Data on a Report—Learner’s Guide

Page 122: BOC310 en Col91 FV Part Ltr Marca

7. Preview the report to view the results.

8. Save the report as Creating groups.rpt.

9. Add the report into the folder in theWorkbench.

Your report should look similar to this example.

Creating nested and multiple groups

You are not limited to one level of grouping within Crystal Reports. You can have groupswithin groups.

For example, you can have a report of all customers, broken down by country, and each countryin turn broken down by region. You could even go further and have a third level, by city.

To create nested or multiple groups

To create nested groups, follow the same steps that you did when you created the first groupon your report.1. For each group, click Insert ➤ Group.

2. Select the group you want from the options in the Insert Group dialog box.

Note: As you add more groups, they are automatically added to the list in the Sort Fieldsarea of the Record Sort Order Expert.

Fundamentals of Report Design—Learner’s Guide106

Page 123: BOC310 en Col91 FV Part Ltr Marca

Reordering groups

You can have very sophisticated reports with groups nestedwithin other groups. For example,your companymay have many distributors in many countries. You want to group by country,then within each country, you want to group by geographic region like Northwest, Central,and so on. Then, you may need to group within each of those regions by state.

You can create groups in any particular order. Groups can be reordered at any time, unlike thesort order of records.

To reorder groups

1. Left-click in the gray area to the left of theDesignwindow and hold the mouse buttondown.The cursor changes to a “hand” to indicate you are reordering or moving a group.

2. Drag the Group Header or Group Footer of the group you want to move and drop it in itsnew location.

To reorder groups using the Group Expert

1. ClickGroup Expert from the Expert Tools toolbar.TheGroup Expert dialog box appears.

107Organizing Data on a Report—Learner’s Guide

Page 124: BOC310 en Col91 FV Part Ltr Marca

2. Use the arrows to rearrange the order of the groups.

3. ClickOK.

Activity: Creating and reordering multiple groups

Objective

• Create multiple groups and then reorder them in hierarchal order.

Instructions

1. Open the Creating groups.rpt from the previous activity.

2. Add country as a group in ascending order.

3. Reorder the groups in your report so that the records are grouped by country and then byregion.

4. Preview the report to see that the groups have been placed in the correct hierarchical orderby country then by region.

5. Save the report as Creating and reordering multiple groups.rpt.

6. Add the report into the folder in theWorkbench.

Fundamentals of Report Design—Learner’s Guide108

Page 125: BOC310 en Col91 FV Part Ltr Marca

Your report should look similar to this example.

Adding a specified order group

Youwant to group your data inways that are not reflected by your database fields. For example,instead of grouping your regions alphabetically, or from the best-selling region to the lowest,you want to sort them geographically.

Specified order grouping enables you to create both the customized groups that will appearon your report and the records that each group will contain.

To specify the order of the grouping, select the field to which you want to apply the specifiedorder grouping and then select in specified order.

109Organizing Data on a Report—Learner’s Guide

Page 126: BOC310 en Col91 FV Part Ltr Marca

The Specified Order tab appears at the top of the Insert Group dialog box.

On this tab, you can create custom group names and specify criteria for each. For example, youmight want to have two groups on your report, one for the Western Region and one for theEastern Region. You could create these two groups by clicking theNew button, then specifywhich states, provinces, or districts belong to each.

The order of the group names in this window is the order they are printed on your report. Youcan reorder these groups by selecting the name and clicking the Up orDown buttons.

After creating a custom group, you need to define which records belong to which group. Youdefine this criteria in theDefine Named Group dialog box. This dialog box functions exactlylike the Select Expert.

Fundamentals of Report Design—Learner’s Guide110

Page 127: BOC310 en Col91 FV Part Ltr Marca

Once you have created at least one custom group, a third tab appears on the Insert Groupdialog box. This tab deals with the records that do not fall into any of the custom groupcategories. By default these records are included in a group calledOthers. You specify whatto do with all the remaining records that do not meet any of the selection criteria of the customgroups in theOthers tab.

The other options include:• Discard all others

This option removes all other records frommemory and does not show them on the report.

• Put all others together, with the name:

This option enables you to specify a customized name for the “Others” group.

• Leave in their own groups

This option groups all remaining records based on the group criteria. For example, if TXdid not fall into either Western or Eastern, all records for Texas would be put into a groupcalled "TX."

111Organizing Data on a Report—Learner’s Guide

Page 128: BOC310 en Col91 FV Part Ltr Marca

You can create groups from either theDesign or Previewwindows. If you are in theDesignwindow, youwill see the newGroupHeader and Group Footer areas surrounding theDetailsarea. For each group you define, a new Group Header and Group Footer is created.

Tip: When you add a grand total, the grand total displays for all records selected by the SelectExpert, not only for those showing on the report after creating specified groups. However, if youapply a specified order grouping and choose to discard others, your grand totals will be correct,calculating only the fields shown on the report.

To create groups in specified order

1. Click Insert ➤ Group.The Insert Group dialog box appears.

2. Select the field you want the data grouped by from the top drop-down list.

3. Select in specified order as your sort option from the second drop-down list.

4. On the Specified Order tab, enter the name of the group in theNamed Group field.

5. ClickNew.

6. In theDefine Named Group dialog box, use the drop-down lists to select the data to bepart of the group.

7. Click the <New> tab to add more selection criteria to your specified group, if necessary.

8. ClickOK.

9. ClickNew to create more custom groups as necessary.

10.Click theOthers tab to specify how you want to organize the data that is not part of thegroup(s) you defined.

11.ClickOK.

Activity: Adding a specified order group

Objective

• Add a specified order group to create customized groups to better reflect the way youwantthe information on the report to appear.

Instructions

1. Open the Creating and reordering multiple groups.rpt from the previous activity.

2. Delete the Region selection criteria.

3. Add new selection criteria for Country to include USA and Canada.

4. Modify the region group to include a “Western Sales Territory” and add California (CA),Idaho (ID), Nevada (NV), and British Columbia (BC) to this group.

Fundamentals of Report Design—Learner’s Guide112

Page 129: BOC310 en Col91 FV Part Ltr Marca

5. Include a second territory named “Eastern Sales Territory” and add Florida (FL), Ohio (OH),Ontario (ON), and Pennsylvania (PA).

6. Include all other regions to “Unassigned Regions.”

7. Save the report as Adding a specified order group.rpt.

8. Add the report into the folder in theWorkbench.Your report should look similar to this example.

Grouping on time-based data

Suppose you wanted a report that showed all employees’ names and their birth dates, but youwanted that report grouped by month. You would then have a list of those employees whohave their birthdays in each month of the year. Or, you might need a report that shows all theorders placed, broken down by yearly quarters. You can group records by Date fields. Whenyou apply grouping on a Date field, a second level of sorting options becomes available.

113Organizing Data on a Report—Learner’s Guide

Page 130: BOC310 en Col91 FV Part Ltr Marca

The first list gives you the option to select on which field you want to base the groupings. Youcan pick the sort order in the second list. If you choose to base your groups on a date field, athird option will appear. In this third list, you can specify the frequency of the groups.

Tip: The options for formatting date, time, anddate/time fields are extensive. You can also customizethe settings to display a field based on your needs.

To insert a group based on a date field

1. Click Insert ➤ Group.The Insert Group dialog box opens.

2. Select the date field on which you want to base the groups in the first drop-down list.

3. Select a sort order.

4. In the third drop-down list, choose the date interval you want to group by.

5. ClickOK.

Activity: Grouping on a date field

Objective

• Apply a group that is built on time-based criteria.

Instructions

1. Open the Adding a specified order group.rpt from the previous activity.

2. Insert a group on order date.

3. Set grouping so the records are grouped by year.

Fundamentals of Report Design—Learner’s Guide114

Page 131: BOC310 en Col91 FV Part Ltr Marca

4. Change this grouping to group the records by month.

5. Format the Group Name to display the full month name and year of the group.

6. Remove the thousands separator from the Order ID.

7. Indent the Region and Order Date groups.

8. Preview the report to view the results.

9. Save the report as Grouping on a date field.rpt.

10.Add the report into the folder in theWorkbench.Your report should look similar to this example.

115Organizing Data on a Report—Learner’s Guide

Page 132: BOC310 en Col91 FV Part Ltr Marca

Summarizing dataOne of the primary purposes for breaking data into groups is to run calculations on each groupof records instead of all records in the report. When the program summarizes data, it sorts thedata, breaks it into groups, and then summarizes the values in each group automatically.

After completing this unit, you will be able to:

• Insert a summary• Insert a group and summary at the same time• Create a group selection based on summary data• Create a grand total

Inserting a summary

Crystal Reports includes a number of subtotaling or summarizing options. A subtotal is thesum of all values from a single field, from all the records in a group. In a sales report, forexample, if you subtotal the amount ordered by sales representative, Crystal Reports gathersall the records that belong to the sales representative and totals the amounts ordered from allthe records.

When the program summarizes data, it sorts the data, breaks it into meaningful groups, andthen summarizes the values in each group automatically.

Depending on the data type of the field you plan to summarize, you can:• Sum the values in each group.• Count all the values or only those values that are distinct from one another.• Determine the maximum, minimum, average, or Nth largest value.• Calculate up to two kinds of standard deviations and variances.

For example:• Customer list reports determine the number of customers in each state. The summarywould

count the distinct customers in each state group.• Order reports determine the average order placed eachmonth. The summarywould calculate

the size of the average order for each month group.• Sales reports determine the total sales per sales representative. The summary would sum

or subtotal the order amounts for each sales representative group.

You can show a field as a percentage based on one group that is a fraction of anotherbroader-based group. For example, you can show the percentage of orders in each region of acountry as compared to the entire country. Or you can show the sales in each city of a countryover the total sales of the entire country. Percentage summary fields support the sum, average,maximum, minimum, count, and distinct count operations.

You apply the percentage summary first by specifying the total value for the second-level group(numerator), then the total value for the broader-based group (denominator).

Fundamentals of Report Design—Learner’s Guide116

Page 133: BOC310 en Col91 FV Part Ltr Marca

In this example, the figure $147,906 shows a subtotal of the last year’s sales for BC. The numberfive (5) shows a summary or count of how many companies are in the group. The percentagesummary of 41.16% is shown as well.

When you insert a summary in your report, the summary is displayed as the summary operationplus what is being summarized.

In this example, “Count of” is the summary operation and the “Customers” field is beingsummarized.

When you select the summary, you see its full name in the Status bar at the bottom of theDesignwindow.

The summary field automatically lines up with and attaches to the same guideline as the fieldit was based on.

You can also insert a simple text object as a label beside your summary field as an explanationto make it meaningful for the user. Adding a text object as an explanatory label in front of thesummary or subtotal helps to further describe the context of the new summary or subtotal. Forexample, a subtotal that sums the sales of a particular region could read “Subtotal of Last Year’sSales by Region.”

You can insert summary information in either theDesign orPreview tabs. The options availablewhen inserting a summary field vary depending on the type of data you are summarizing.

Tip: You do not need to select the field you want to summarize (or subtotal) before any of thesemenu options are made available. You can choose this field in the Insert Summary dialog box.

To insert a summary

1. Click Insert ➤ Summary.You can also click the Insert Summary button on the Insert Tools toolbar.

117Organizing Data on a Report—Learner’s Guide

Page 134: BOC310 en Col91 FV Part Ltr Marca

The Insert Summary dialog box opens.

2. Select the desired field to summarize from the Choose the field to summarize list.

3. Select a summary operation from the Calculate this summary list.

4. Select a location in which to place the summary from the Summary location list.To subtotal, choose the groupwhichwill determine the subtotaled amount from the Summarylocation list. For example, if you select a sales amount, you could choose to subtotal byregion, which would give you a subtotaled sales amount for each region.

5. ClickOKwhen finished.

Inserting a group and summary at the same time

If there are currently no groups on the report, you can group and summarize all in one step.

To insert a group and a summary

1. Click Insert ➤ Summary.

Fundamentals of Report Design—Learner’s Guide118

Page 135: BOC310 en Col91 FV Part Ltr Marca

The Insert Summary dialog box opens.

2. Choose the field to summarize.

3. Select the calculation.

4. Select a location in which to place the summary from the Summary location list.

Tip:

• You can create a new group for your report by clicking the Insert Group button.• You can add your summary to all group levels by clicking the Add to all group levels

check box.

The Insert Group dialog box opens.

119Organizing Data on a Report—Learner’s Guide

Page 136: BOC310 en Col91 FV Part Ltr Marca

5. On the Common tab, select the group from the first list, and then select the sort order.

6. ClickOK to close the Insert Group dialog box.

7. ClickOK to close the Insert Summary dialog box.

The group is created at the same time as the summary.

You can group on any field used on the report or in the table(s) selected for that particularreport. You can sort on any field that is used on the report or in the database tables selectedfor that report.

Activity: Inserting summaries

Objective

• Create summaries for the grouped data and label the totals.

Instructions

1. Open the Grouping on a date field.rpt from the previous activity.

2. Insert a count of the Order ID for each month (Order Date group).

3. Insert a subtotal on Order Amount for each month (Order Date group).

4. Add a percentage summary for each month (Order Date group) for Order Amount basedon the entire report.

5. Rearrange the percentage summary to be under the subtotal summary.

6. Add the appropriate text objects beside each summary as labels.

7. Preview the report to view the results.

8. Save the report as Inserting summaries.rpt.

Fundamentals of Report Design—Learner’s Guide120

Page 137: BOC310 en Col91 FV Part Ltr Marca

9. Add the report into the folder in theWorkbench.Your report should look similar to this example.

Creating a group selection based on summary data

When you group or summarize data, all the groups in the report are included by default. Theremay be times, however, when you do not want to include all groups:• Youmightwant to see only those groupswhose summarized valuesmeet a certain condition.• You might want to see only the groups with the highest summary values, or the lowest.

For example, if you have a mailing list grouped by region and your record selection formulaspecifies only California customers ({Customer.Region} = “CA”), your report will have onlythe single group of California.

The Select Expert can be used to select groups of records in the same way that you selectindividual records.

When you are setting up group selection criteria, instead of basing the selection criteria onstandard fields, as you do for record selection, you base the criteria on group name fields orsummary fields.

121Organizing Data on a Report—Learner’s Guide

Page 138: BOC310 en Col91 FV Part Ltr Marca

• If you have grouped your data but have not summarized it, you can only set up groupselection based on the group name field. For example, you may want to select only thosegroups whose Region is Massachusetts:GroupName ({Customer.REGION}) = “MA”

• If you have summarized your data, you can set up group selection based on either the groupname field or the summary field. For example:Sum({Customer.LAST YEAR’S SALES}, {Customer.REGION}) > 10000

The Select Expert can be used to set up record selection and group selection requests. When agroup name or summary field is selected, the program knows that the selection criteria youset up is intended for group selection. In all other cases, the programknows that you are settingup record selection.

Tip: Group selection is not so much selection as it is suppression. All of the groups are still in thereport. However, only the selected groups are showing. The group tree and any grand totals areprocessed prior to group selection. For this reason, the group tree and grand totals will continue toreflect all groups, including those that are excluded by the group selection criteria.

To create a group selection based on summary information

1. Right-click the summary field onwhich youwant to base group selection and choose SelectExpert from the shortcut menu.The Select Expert dialog box appears.

Note: If you click the Select Expert button without first highlighting a summary field inyour report, the Choose Field dialog box appears.

2. Use the drop-down list to enter your selection criteria for the indicated field.

3. To base the group selection on more than one field, click theNew tab and choose the nextfield from the Choose Field dialog box.

Note: If you have not already previewed the report or refreshed the data, there will not beany data savedwith the report.Without the data, the program cannot calculate group values;thus, no values appearwhen you click the arrow in the right drop-down list. In this situation,you will have to type in the values you want. If you want real values to work with, you willneed to preview your report first. This will calculate the actual summary values availablefor you to work with.

Fundamentals of Report Design—Learner’s Guide122

Page 139: BOC310 en Col91 FV Part Ltr Marca

4. When you are finished, clickOK in the Select Expert to return to the report.

Activity: Grouping on summary data

Objective

• Create a group on data that has been summarized.

Instructions

1. Open the Inserting summaries.rpt from the previous activity.

2. Change the report to show only months that had more than 10 orders.

3. Preview the report to view the results.

4. Save the report as Grouping on summary data.rpt.

5. Add the report into the folder in theWorkbench.Your report should look similar to this example.

Creating a grand total

Once you have produced summary information for each group, you may also want to have asummary for the whole report. Known as a grand total, this total displays at the end of thereport in the Report Footer.

123Organizing Data on a Report—Learner’s Guide

Page 140: BOC310 en Col91 FV Part Ltr Marca

Because a grand total serves as a summary for an entire report as opposed to a group, it canperform the same types of calculations that summary fields can. Again, the options availabledepend on the data type on which you are basing the calculation.

To insert a grand total

1. Click Insert ➤ Summary.The Insert Summary dialog box opens.

2. Select the desired field to summarize from the Choose the field to summarize list.

3. Select a summary operation from the Calculate this summary list.

4. Select a location in which to place the summary from the Summary location list.The Grand Totals option is placed in the Report Footer.

5. ClickOKwhen you are finished.When you select the Grand Total field in the report, you see its full name in the Status bar.The Grand Total field automatically lines up with and attaches to the same guideline as thedata field it was based upon.

Activity: Inserting a grand total

Objective

• Add a summary for the entire report called a grand total.

Fundamentals of Report Design—Learner’s Guide124

Page 141: BOC310 en Col91 FV Part Ltr Marca

Instructions

1. Open the Grouping on summary data.rpt from the previous activity.

2. Remove the group selection for months that had more than 10 orders.

3. Change the record selection to show all customers in the USA. (1051 records)

4. Add a field to the report that counts howmany customers in total are included in this report.

5. Change the count to a distinct count. (90 records)

6. Add another field that shows the total Order Amount for the entire report and delete thedecimals.

7. Add text objects beside each summary to describe them.

8. Format the labels and the grand total field to stand out on your report.

9. Preview the report to view the results.

10.Save the report as Inserting a grand total.rpt.

11.Add the report into the folder in theWorkbench.Your report should look similar to this example.

125Organizing Data on a Report—Learner’s Guide

Page 142: BOC310 en Col91 FV Part Ltr Marca

Quiz: Organizing data on a report1. Can each field in the Sort Fields list be assigned a sort direction in ascending or descending

order independently?

2. What is the function of the Group Tree?

3. How would you create groups that are not reflected by the fields in your database?

4. Why would you want to have the group header repeat on every page?

5. What is the difference between a subtotal and a summary?

Fundamentals of Report Design—Learner’s Guide126

Page 143: BOC310 en Col91 FV Part Ltr Marca

Lesson summaryAfter completing this lesson, you are now able to:

• Sort records• Group records• Summarize data

127Organizing Data on a Report—Learner’s Guide

Page 144: BOC310 en Col91 FV Part Ltr Marca

Fundamentals of Report Design—Learner’s Guide128

Page 145: BOC310 en Col91 FV Part Ltr Marca

Lesson 5Formatting a Report

Lesson introductionPresentation quality reports are easy to create in Crystal Reports. Many different formattingoptions exist to make the information in your report not only stand out, but be moreunderstandable.

After completing this lesson, you will be able to:

• Add graphical elements• Combine text objects with database fields• Apply specialized formatting• Insert fields with pre-built functions

129Formatting a Report—Learner’s Guide

Page 146: BOC310 en Col91 FV Part Ltr Marca

Adding graphical elementsIf you want to make specific data or summaries stand out from the rest of the report or justwant to improve the overall appearance, you can use graphic elements to enhance your report.When working with graphic elements, you may prefer to work in theDesignwindow; it iseasier to see in which area you are working, and easier to ensure that graphic elements suchas lines, boxes, and pictures are positioned correctly.

After completing this unit, you will be able to:

• Add a line to a report• Add a box to a report• Add a graphic to a report• Add a dynamic image object

Adding a line to a report

You can add lines to your report to make information stand out from the rest of the report. Forexample, a line in theGroup Header section will print once for every group, differentiatingeach separate group.

To draw a line

1. Click the Insert Line button on the Insert Tools toolbar.

You can also click Insert ➤ Line.

A pencil cursor appears on the screen.

2. Position the pencil to the place where you want to begin drawing the line and drag yourmouse to where the line should end.

3. Release the mouse button.

To format a line

1. Right-click the line and click Format Line from the shortcut menu.

Fundamentals of Report Design—Learner’s Guide130

Page 147: BOC310 en Col91 FV Part Ltr Marca

The Format Editor opens, displaying the Line tab.

2. Make changes to the line.

The Format Line dialog box options include line style (solid, small dash, long dash), width(thickness), and color.

3. ClickOK.

Tip: To avoid the line being dragged out of position, select the Lock Position and Sizecheck box.

Note: You can also use the Format Painter.

To move a line

1. Click the line to activate the handles on each end.

2. Use the four-way cursor to move your line to a new position.

To resize a line

1. Click the line to activate the sizing handles that appear on each end of the line.

2. If you click one of the handles and hold the left mouse button down, you can resize yourline.

You can draw only straight horizontal or vertical lines using this feature in Crystal Reports.

131Formatting a Report—Learner’s Guide

Page 148: BOC310 en Col91 FV Part Ltr Marca

Adding a box to a report

You can insert square or rectangular boxes into your report aswell as ellipses, circles, and boxeswith varying degrees of rounded corners. These shapes are useful if you are creating forms.

Pay close attention towhere you are placing your box. A box spanning the group header, detailsarea, and group footer prints once for every group of records. A box in the Details section printsonce for every record. You can put a box around groups or each individual record in the report.

To draw a box

1. Click the Insert Box button on the Insert Tools toolbar.

You can also click Insert ➤ Box.

A pencil cursor appears on the screen.

2. Use the tip of the pencil to drawwith. Position the pencil where you want one corner of thebox and drag your mouse to the opposite corner of the desired box.

3. Release the mouse button.

To format a box

1. Right-click the box and choose Format Box from the shortcut menu.The Format Editor opens.

2. Make any changes to the box.The format border options include line style, width, and color. You can also assign a fillcolor and a drop shadow.

Fundamentals of Report Design—Learner’s Guide132

Page 149: BOC310 en Col91 FV Part Ltr Marca

3. Select theRounding tab to adjust the corners of the box to the curve you want for the edgesof the box.

4. Use the slider to adjust the curve, or enter a percentage in the Rounding edit box.

Note: If you have specified rounding for a box, you cannot use theDrop Shadow optionthat is usually available on the Box tab of the Format Editor.

5. ClickOKwhen you are finished.

To move and size a box

1. Click the box.

Handles appear around the box.

2. Move the cursor over the box and use the four-way cursor to move your box to a newposition.

3. Click and drag one of the center handles to stretch the box either horizontally or vertically.You can also size your box vertically and horizontally at the same time by clicking anddragging one of the four corner handles.

Adding a graphic to a report

Often,whendeveloping your reports, youwillwant to include a picture or graphic. For example,you might want to put a graphic of your product or the corporate logo at the top of a report.

133Formatting a Report—Learner’s Guide

Page 150: BOC310 en Col91 FV Part Ltr Marca

You will find it easier to work in theDesignwindow when placing a picture on a report soyou can ensure it appears within the section you want.

To insert a graphic

1. Click the Insert Picture button on the Insert Tools toolbar.

You can also click Insert ➤ Picture.

TheOpen dialog box appears.

2. Locate the graphic file you want to use on the report and clickOpen.

A picture field object attaches to the cursor.

3. Place the upper left corner of the graphic on your report where you want that corner to beand click the mouse button to release.The area or section in which you are placing the graphic automatically expands toaccommodate the graphic.

Tip: When placing an object onto your report, ensure the top edge of the object is placedin the section in which you want to insert the object. If necessary, the height of the sectionis automatically increased to display the object.

To format a graphic

1. Right-click the graphic and choose Format Graphic from the shortcut menu.

Fundamentals of Report Design—Learner’s Guide134

Page 151: BOC310 en Col91 FV Part Ltr Marca

The Format Editor opens.

2. Make any changes to the box.

You will be able to:• Suppress the printing of the picture and other properties from the Common tab.• Crop, scale, and size the picture from the Picture tab.• Add a border, change the color of the border or fill, and add a drop shadow from the

Border tab.

3. ClickOKwhen you are finished.

Adding a dynamic image object

Objects can be inserted into Crystal Reports usingOLE (Object Linking and Embedding), whichenables you to add objects from other applications and then use those applications fromwithinCrystal Reports to edit the objects if necessary. These objects are often referred to asOLE objects.

You can now place pictures and graphics in a report through a link stored in a database, sothat it is no longer necessary to store images within the database. This new feature supportsthe common practice of storing images on a web server and storing references to those imagesin a database.

135Formatting a Report—Learner’s Guide

Page 152: BOC310 en Col91 FV Part Ltr Marca

A dynamic image object is a picture or metafile (PNG, JPG, WMF, BMP, TIF) that you accessin Crystal Reports by use of a file path or URL. Typically, you use this option when you havethe path to your pictures or metafiles stored as a string field in a database (that is, you do nothave the actual objects stored in the database). You can also use this option when you havepictures ormetafiles stored on a network share, and you know these objects change occasionally.The functionality of these dynamic image objects is created in Crystal Reports through the useof a conditional formatting formula that allows you to link to static OLE objects by reference.

Reports that use an absolute or a relative path for a dynamic image object are not supportedin a BusinessObjects Enterprise environment for this release. If you plan to publish reports thatcontain dynamic image objects to BusinessObjects Enterprise, it is recommended that you useURL links for your OLE objects.

Note: This feature is activated when you refresh your report data. You may not notice a change inthe static OLE object until you click the Refresh button in Crystal Reports. Dynamic images aresaved in the report with saved data.

To add a dynamic image object

1. Right-click the image that you inserted and choose FormatGraphic from the shortcutmenu.

Note: You begin the process of making an image dynamic by inserting the object into yourreport as usual. This object becomes the default object. If Crystal Reports cannot find thedynamic reference to the object, it uses the default object instead.

2. In the Format Editor, click the Picture tab, and then click the conditional formatting buttonadjacent to theGraphic Location label.

3. In the Formula Workshop, create the path to your static image object.

4. Click Save and close to return to the Format Editor.

5. ClickOK to return to your report.

6. Click Refresh to update the reference link to the image object.

Activity: Adding graphical elements

Objective

• Add graphical elements to your report to make the information stand out.

Instructions

1. Open the Inserting a grand total.rpt from the previous lesson.

2. Ensure you are logged on to the Repository Explorer. Locate the Xtreme company logo.Place the logo onto the report in the Report Header. Close the Repository Explorer.For this activity, you can find the Xtreme company logo in these locations:• In the Images folder in the repository (under the Repository Items folder).• In the Company Logo folder in the Lesson 5 folder in the course resources.

Fundamentals of Report Design—Learner’s Guide136

Page 153: BOC310 en Col91 FV Part Ltr Marca

Note: This option is available if there is no access to BusinessObjects Enterprise or if nologo is found on BusinessObjects Enterprise.

3. Adjust the report title to accommodate the logo.

4. Delete the thin blue lines under the column headings.

5. Place a thick blue line under all of the column headings.

6. Draw a thick blue box bordering the Order Date group.

7. Move the Order Date group name to be more readable, if required.

8. From the Field Explorer insert the Region andOrder Date group name into the appropriateGroup Footers.

9. Create a folder called My Pictures in My Documents, if one doesn't exist.

10.From the Original Copyright folder in the Lesson 5 folder in the course resources, copythe copyright.jpg into the My Pictures folder in My Documents.

11.Insert the copyright image into thePage Footer from the My Pictures folder in My Documents.

12.Make this image object dynamic by creating a path to the My Pictures folder in My

Documents.Remember to include quotation marks.

13.Refresh the report and view the results.

Your report should look similar to this example.

137Formatting a Report—Learner’s Guide

Page 154: BOC310 en Col91 FV Part Ltr Marca

14.You’ve just been informed byMarketing that the copyright image has been changed. Locatethe new image object in the New Copyright folder in the Lesson 5 folder in the courseresources. Choose to overwrite the existing file when you copy it into the My Pictures folderin My Documents.

15.Refresh the report to view the changed copyright image object.The copyright image changes dynamically to the new version.

Your report should look similar to this example.

16.Save the report as Adding graphical elements.rpt.

17.Add the report into the folder in theWorkbench.

Fundamentals of Report Design—Learner’s Guide138

Page 155: BOC310 en Col91 FV Part Ltr Marca

Your report should look similar to this example.

Note: The path specified for the dynamic graphic location in the solution report may bedifferent than the one created on the local machine, resulting in the copyright not updatingin the solution report. If you want the copyright to update on your local machine, open theformula for the graphic location and change the path to reflect what is being used on thelocal machine.

139Formatting a Report—Learner’s Guide

Page 156: BOC310 en Col91 FV Part Ltr Marca

Combining text objects with database fieldsDatamakes up themajority of your report. Often, however, you need to combine ormanipulatedata, add labels, or paragraphs to your report to make them more functional.

You have learned how to insert a text object and edit the text within it. You can also create textobjects that contain plain text for use as titles on your report, combine text with different typesof fields and format any element of a text object.

After completing this unit, you will be able to:

• Embed a database field into a text object• Prevent the truncation of a text object• Format individual elements of a text object

Embedding a database field into a text object

To print embedded text and field information or to embedmultiple fields, you embed the fieldinto a text object. For example, youmight want to create a form letter with the beginning “DearMr. Smith,”where “Mr.” and “Smith”were part of your database, and you added the salutation.You can insert a field into a text object by using a menu command, a button, or a dialog box.

Many databases add blanks or spaces after the text of their string fields. Inserting databasefields into text objects with Crystal Reports automatically trims any trailing spaces from thebeginnings or ends of the data.

If you were to put these three data fields into a text object, Crystal Reports trims any excesscharacters, and joins them so they flow:

Mr. Paul Smith

Ms. Elaine Jones

Ms. Carol Smith-Jones

To embed a database field into a text object

1. Double-click the text object to enter the edit mode.A blinking cursor appears.

2. In the Field Explorer, select the field you want to add.

3. Drag the field into the text object.You can also select multiple fields and insert them into the text object simultaneously.

As you approach the text objectwith the cursor, watch for the vertical insertion line to appearinside the text object.

Tip: Do not let go of the mouse button until the vertical insertion line is in the position youwant the database field to print.

Fundamentals of Report Design—Learner’s Guide140

Page 157: BOC310 en Col91 FV Part Ltr Marca

4. Move the cursor to place the insertion point where you want it to appear in the text object.

If you place the database field correctly, it will look like this:

Tip: Select the Show Field Names option in FileOptions to read the database field namesas you insert them into your text objects.

Note: Embedding a text object within another text object is not possible.

Preventing truncation of text objects

Sometimes it is difficult to predict how long or tall you should make your text objects if thedata fields that have been embedded contain varying lengths of data.

You can use theCanGrow option to prevent truncation of text objects, that is, to allow the textbox to expand vertically, if necessary, to fit all text and data from the embedded fields, likeword wrap in a word processing application.

Remember to size your text objects with the printed result in mind. Do not worry if the fullnames of the database or special fields are not visible in theDesign tab. The printed result iswhat matters.

To prevent truncation of text objects

1. Right-click the text object and select Format Text from the shortcut menu.The Format Editor opens.

141Formatting a Report—Learner’s Guide

Page 158: BOC310 en Col91 FV Part Ltr Marca

2. Select the Can Grow check box on the Common tab and enter the maximum number oflines that you want the field to expand.

Note: The Can Grow option does not expand horizontally.

Formatting individual elements of text objects

You can format the individual elements of a text object independently. An element is any singleitem that is contained in a text object. The word “report” is made up of six elements, since eachletter could be selected and formatted individually. Each field that is inserted into a text objectis an element.

This text object is made up of eight elements: Four, for each of the letters in the word “Dear,”one for each of the database fields, and two for the spaces between the words.

Once you select elements, you can format them in much the same way you format the textobject as a whole.

Fundamentals of Report Design—Learner’s Guide142

Page 159: BOC310 en Col91 FV Part Ltr Marca

To format text or fields individually within a text object

1. Double-click the text object to put it into edit mode.The broken line frame and ruler bar appear.

2. Select the element(s) you want to format.Elements can be a selection of text or a field.

3. Right-click the selected element(s) and select the formatting option from the shortcutmenu.The appropriate dialog box appears.

For example, if you selected text to format, the Text Format dialog box opens:

4. Make the changes you require.

5. ClickOK.

Setting tabs in a text object

Each text object can have its own tab setting.

To set tabs

1. Click in the text object to put it into edit mode.The ruler line appears.

143Formatting a Report—Learner’s Guide

Page 160: BOC310 en Col91 FV Part Ltr Marca

2. Click the ruler line where you want to place the tab.

To move a tab

1. Drag it to a new position on the ruler.

To remove a tab

1. Drag it off of the ruler line and let go.

Tip: Editing text objects is like using aminiword processor. You can add tabs, set paragraphalignments, and create indentations.

Fundamentals of Report Design—Learner’s Guide144

Page 161: BOC310 en Col91 FV Part Ltr Marca

Applying specialized formattingYou can customize your report to be presentation quality using several options.

After completing this unit, you will be able to:

• Format multiple objects• Apply a predefined template• Apply text rotation• Apply accounting conventions• Apply numeric, currency, date, time, and date/time formatting

Formatting multiple objects

Use the Format Painter to copy formatting properties from one report object to one or moretarget objects. The Format Painter button displays on the Standard toolbar when you select asource object in your report. If you apply formatting to a target field that is not the same asyour source field, only the common properties are applied.

Some things to keep in mind about the Format Painter:• The Format Painter does not copy hyperlink information to a target object or field.• The Format Painterdoes not copy formatting that is applied through use of theHighlighting

Expert.• The Format Painter does not copy formatting from text/template objects to database fields.• When using a Date and Time field as your source, a target field’s date or time properties

are changed; the reverse is also true (that is, a Date field or a Time field used as your sourcealso affects the date and time properties of a Date and Time field).

This tables lists the source report objects and fields and the applicable targets you can use withthe Format Painter.

Target object or fieldSource object or field

Report field (not in a cross-tab)Report field (not in a cross-tab)

Report field in a cross-tabReport field in a cross-tab

Template fieldTemplate field

Text object (not in a cross-tab)Text object (not in a cross-tab)

Text object in a cross-tabText object in a cross-tab

Object in an OLAP grid headerObject in an OLAP grid header

145Formatting a Report—Learner’s Guide

Page 162: BOC310 en Col91 FV Part Ltr Marca

Target object or fieldSource object or field

Line objectLine object

Box objectBox object

OLE or BLOB fieldOLE or BLOB field

SubreportSubreport

Chart, map, OLAP grid, or cross-tabChart, map, OLAP grid, or cross-tab

To copy and apply formatting

1. Select a source object or field in your report and click Format Painter.

Tip: You can also select Format Painter from the shortcut menu.

Note:

• The Format Painter button is not available until you select an object or field.• Click the button a second time, or press Esc, to exit the Format Painter.• You cannot apply formatting to read-only objects or fields.• Hold theAlt key down if you want to apply formatting to more than one object or field.

2. Click the target object or field.When you move your mouse over your report, the cursor changes to a Stop cursor if theobject or field cannot be used as a target.

Applying predefined templates

A template is an existing report file whose formatting can be added to a new or existing report.You can use the templates found in the Template Expert to give any number of reports aconsistent look without having to format each report individually.

Use the Template Expert command to apply one of several professionally-designed styles toyour report. When you choose the Template Expert command, the Template Expert appears.

Use this dialog box to select a report style and apply it to your report.

Fundamentals of Report Design—Learner’s Guide146

Page 163: BOC310 en Col91 FV Part Ltr Marca

To apply a predefined template

1. Click Report ➤ Template Expert.You can also click the Template Expert button on the Expert Tools toolbar.

The Template Expert appears.

147Formatting a Report—Learner’s Guide

Page 164: BOC310 en Col91 FV Part Ltr Marca

2. Choose a template.

3. ClickOK.

Note: If a template has already been applied, you can undo the current template or reapplythe last template in the Template Expert. If you want to have the headings print verticallyto save space on your report, use text rotation, sometimes referred to as vertical text. Designedprimarily to support formatting in foreign languages (for example, Japanese), you can formatstring fields, memo fields, and text objects vertically.

Applying text rotation

You can export a report with vertical text to various formats; a report with vertical text can alsobe exported to the web and viewed in a report viewer, a type of specialized web browser forCrystal Reports.

Note: You can only rotate text in a True Type font or printer font.

To apply text rotation

1. Right-click the object and choose the appropriate formatting option from the shortcutmenu.

Fundamentals of Report Design—Learner’s Guide148

Page 165: BOC310 en Col91 FV Part Ltr Marca

The Format Editor opens, displaying the Common tab.

2. Select the degree of rotation you want from the Text Rotation list.

• 0 degrees: default setting• 90 degrees: direction of text is bottom to top, left to right• 270 degrees: direction of text is top to bottom, right to left

3. ClickOK.

The text rotation is applied to the object you selected.

Applying accounting conventions

To support conventions used in accounting, you can control how the negative symbol, currencysymbol, and zero value are displayed. You can also reverse the sign when displaying numbersin accounting reports and determine whether overflow field representation is enabled for theselected field(s), commonly referred to as field clipping.

149Formatting a Report—Learner’s Guide

Page 166: BOC310 en Col91 FV Part Ltr Marca

To apply accounting formatting

1. Right-click the currency or number field and click Format Field from the shortcut menu.The Format Editor opens, displaying the appropriate options for the number or currencyfield selected.

2. Click theNumber tab to make it active, if it is not displayed.

3. Click the Customize button.

Fundamentals of Report Design—Learner’s Guide150

Page 167: BOC310 en Col91 FV Part Ltr Marca

The Custom Style dialog box opens.

4. Select the Use Accounting Format check box.

5. Choose the formatting style you want to apply for decimals, negatives, separators, androunding.You can also select the Reverse Sign for Display check box to have the signs of numbers(plus or minus) reverse their sign when displaying debit or credit amounts in financialreports.

6. ClickOK to apply the formatting and close the Custom Style dialog box.

7. ClickOK to close the Format Editor.

Applying numeric, currency, date, time, and date/time formatting

You can fine tune the formatting of number, currency, date, time, and date/time fields.

Number field

Use the options on theNumber tab of the Format Editor.

151Formatting a Report—Learner’s Guide

Page 168: BOC310 en Col91 FV Part Ltr Marca

You can choose from a list of sample styles, including the system default settings, or you cancustomize the style of the number display:• System Default

Whatever you have specified through yourmachine’s Control Panel is the designated systemdefault.

• Sample styles

Click one of the sample styles to apply that type of formatting.

• Customize

If you do not choose the systemdefault number format or any of the sample number formatsbut want to customize one of these styles further, you make alterations to these styles byclicking the Customize button.

Currency

You change the formatting of a currency field in the same way as you do a number field in theNumber tab of the Format Editor. Because you select a currency field, the options that appearin the Style area of theNumber tab change to currency formatting examples.

The currency options are listed in the Format Editor.

Fundamentals of Report Design—Learner’s Guide152

Page 169: BOC310 en Col91 FV Part Ltr Marca

The options are:• Display currency symbol

SelectDisplay currency symbol to have the symbol appear on the report. Set whether thesymbol is fixed in one position or whether the symbol “floats” with the currency numbersby clicking the option buttons.

• System Default

This choice reflects the default format that is set up in your machine’s Control Panel.

• Sample styles

Choose a style that meets your formatting requirements.

• Customize

You can further customize the way your currency formats display on your report.

Date, time, and date/time fields

Use the options in theDate and Time tab of the Format Editor to customize the display of yourdate and time fields. Depending on the type of field you have selected to format, theDate andTime tab of the Format Editor displays the appropriate system default formats and samplestyles for that type of field.

153Formatting a Report—Learner’s Guide

Page 170: BOC310 en Col91 FV Part Ltr Marca

The options are:• System Default

The choicesSystemDefault Long Format andSystemDefault Short Format are the defaultformats that have been defined through your machine’s Control Panel.

• Sample styles

Use the sample style format to customize the formatting of your date, time, or date/timefields quickly.

• Customize

If you do not choose any of the system default formats or sample formats, you can furthercustomize your formatting through the Custom Style dialog box.

To customize a sample style

1. Choose the system default format or one of the sample styles that you think looks closestin format to the one you want to create for either a number or currency field.

2. Click Customize.The Custom Style dialog box opens.

Fundamentals of Report Design—Learner’s Guide154

Page 171: BOC310 en Col91 FV Part Ltr Marca

If the field is a number, youmake the modifications in theNumber tab of theCustom Styledialog box.

If your selection is a currency field, you make the modifications in the Currency Symboltab of the Custom Style dialog box.

155Formatting a Report—Learner’s Guide

Page 172: BOC310 en Col91 FV Part Ltr Marca

3. Make the modifications, as necessary.

4. ClickOK.

To customize a date, time, or date/time field

1. Choose a system default format or one of the sample format styles that you think is closeto your requirements.

2. Click Customize.The Custom Style dialog box opens.

3. Use the appropriateDate, Time, orDate and Time tabs of the Custom Style dialog box tofurther customize the field.After you have defined a customized format, a new item called Custom Style appears inthe Style area of theDate and Time tab in the Format Editor.

Caution: The Custom Style item only appears in the list of styles if you have defined andselected it as the style to use for that type of field. If you choose the system default or asample style after using the custom style, the custom style will be discarded. This actionapplies to a number, currency, date, time, or date/time field.

Fundamentals of Report Design—Learner’s Guide156

Page 173: BOC310 en Col91 FV Part Ltr Marca

Activity: Applying formatting elements

Objective

• Apply formatting elements by embedding database fields into text objects, preventing thetruncation of text, and changing the font and color of a text object.

Instructions

1. Open the Adding graphical elements.rpt you created in the previous activity.

2. Insert all of the subtotals and grand total values into their respective text objects.

3. Prevent the truncation of the subtotal and grand total values by selecting the Can Growoption.

4. Preview the report to ensure that the subtotals and grand total value appear correctly.Remember that the Can Grow option doesn’t work horizontally.

5. Adjust the grand total value to display correctly.

6. Align the subtotal and grand total value to the right in the Order Amount column.

7. Select the words “Customers & Orders” within the report title text object and change thefont color to Maroon and font style to bold.

8. Save the report as Adding formatting elements.rpt.

9. Add the report into the folder in theWorkbench.

Your report should look similar to this example for the report title.

157Formatting a Report—Learner’s Guide

Page 174: BOC310 en Col91 FV Part Ltr Marca

Your report should look similar to this example for the grand total.

Fundamentals of Report Design—Learner’s Guide158

Page 175: BOC310 en Col91 FV Part Ltr Marca

Inserting fields with pre-built functionsCreating reports that are presentation quality can sometimes take a lot of time. Many factorscan influence how long it takes to create a report: length of the report, volume of data, or theformat in which you want the report presented. You can reduce the amount of time spentformatting reports by using special fields, which are fields that contain pre-built functions.

After completing this unit, you will be able to:

• Insert special fields• Format special fields• Embed a special field into a text object

Inserting special fields

Special fields contain information that is not included in the database, but is useful to the overallpresentation quality of the report, making your report more readable.

Some of the more commonly used special fields are:• Current CEUser ID: displays the ID number of the current BusinessObjects Enterprise user

(if one exists).• Current CE User Name: displays the name of the current BusinessObjects Enterprise user

(if one exists).• Data Date: prints the date the data was last refreshed on a report with saved data.

159Formatting a Report—Learner’s Guide

Page 176: BOC310 en Col91 FV Part Ltr Marca

• Data Time: prints the time the data was last refreshed on a report with saved data.• File Creation Date: prints the date the file was first created.• File Path and Name: prints the directory path of the file.• Modification Date: prints the date the report was last modified.• Modification Time: prints the time the report was last modified.• Page N of M: prints the current page number of the total number of pages.

Note: Page N of M uses page on demand, meaning that Crystal Reports will not format apage until it is requested by the user, or until it is required for the total page count.

• Page Number: prints the current page number.• Print Date: prints the current date as per your computer’s clock.• Print Time: prints the current time as per your computer’s clock.• Report Comments: prints the contents of the Comments area in theDocument Properties

in the File ➤ Summary Info menu.• Report Title: prints the contents of the Title area in theDocument Properties dialog box

in the File ➤ Summary Info menu.• Total Page Count: prints the total number of pages in the report.

Tip: If you have created and saved a report and then months later could not remember the filename or location, put the file name and location into the Title area in theDocument Propertiesdialog box in the File ➤ Summary Infomenu. Then, place the Report Title special fields in theReport Footer. You can also use the File Path andName special field to perform the same function.

Fundamentals of Report Design—Learner’s Guide160

Page 177: BOC310 en Col91 FV Part Ltr Marca

To insert a special field

1. From the Field Explorer, locate and expand the Special Fields list.

2. Scroll through the list to locate the special field you want to use.Once you select the field, a box is attached to the cursor.

3. Drag the field in the desired location and click to drop it onto the report.

Formatting special fields

The formatting options for each of the special fields varies depending on the data type thespecial field creates.

To format a special field

1. Right-click the special field and choose Format Field from the shortcut menu.The Format Editor opens with the appropriate tab for the data type you are formatting.

2. Make the desired changes.

3. Click the other tabs to make any other changes.

4. ClickOK.

161Formatting a Report—Learner’s Guide

Page 178: BOC310 en Col91 FV Part Ltr Marca

Tip: Changing the date order does not change the placement of the options in the Formatarea. To see how your date will print, remember to look at the sample at the bottom of thedialog box.

Note: The separator boxes can accommodate several characters each. Do not forget to adda space in the separator box if that is what you want between the date elements.

Embedding a special field into a text object

You can place special fields inside a text object to complete a sentence, or when informationchanges if the report changes. For example, if you need to know each time the report wasmodified, you would insert a special field into a sentence that states when the report was lastchanged.

When inserting a special field into a text object, you follow the same steps as inserting a databasefield.

To embed a special field into a text object

1. In the Field Explorer, locate the Special Fields list and expand its contents.

2. Click the field you want to insert into the text object from the scrolling field list.

3. Drag the field from the menu until the cursor shows a vertical insertion point inside yourtext object at the position you want the field to print.You can also select the field, and then click the Insert button at the top of the dialog box.

4. Once the insertion point is in the desired place, click the mouse button to release the fieldinto the text object.

Activity: Adding special fields

Objective

• Add several special fields to your report to cut down on the time spent formatting individualelements.

Instructions

1. Open the Adding formatting elements.rpt file you created previously.

2. Add these special fields to your report:

• Print date at the top of the report in the Report Header• Page number at the bottom of each page.

3. Format the special fields:

• Format the date to print like March 1999.• Bold the Page Number text object.

Fundamentals of Report Design—Learner’s Guide162

Page 179: BOC310 en Col91 FV Part Ltr Marca

4. Insert the print date special field inside of the text object.

5. Insert a text object that says Printed: in front of the print date and bold the Printed: textobject.

6. Insert a text object that displays Page Number: in the Page Footer.

7. Insert the page number special field into the text object.

8. Change the font color of the City column heading to Maroon.

9. Use the Format Painter to apply the new formatting of the City column heading to all thecolumn headings.

10.Save the report as Adding special fields.rpt.

11.Check the report for errors using theDependency Checker.

12.Add the report into the folder in theWorkbench.

Your report should look similar to this example for the Print date.

163Formatting a Report—Learner’s Guide

Page 180: BOC310 en Col91 FV Part Ltr Marca

Your report should look similar to this example for the Page number.

Debrief: Validating the report design

Objective

• Ensure that the completed report looks similar to the report prototype.

Instructions

1. Map each item on the report prototype form to the completed report:

• The report reflects the purpose of the report.• The header includes the company logo, a report title, print datewith label, and a copyright.• The body of the report includes the customers’ names, their location, the date they placed

the order, the amount of their orders, and the locator order number (ID).• The report displays only the Western Sales Territory and Eastern Sales Territory, with

the other groups not assigned to any specific groups.• The report contains USA data only and for the year 2004.• The report displays summarized data:

○ The number of orders by date.○ A subtotal and a grand total.○ A percentage of order amount compared to the grand total.○ The number of unique or distinct customers.

Fundamentals of Report Design—Learner’s Guide164

Page 181: BOC310 en Col91 FV Part Ltr Marca

• The key information has been highlighted in some manner.

165Formatting a Report—Learner’s Guide

Page 182: BOC310 en Col91 FV Part Ltr Marca

Quiz: Formatting a report1. The copies formatting properties from one report object to one or more target objects

when you first select a source object in a report and then apply that object’s formatting toa target field.

2. The gives any number of reports a consistent look without having to format eachreport individually.

3. Graphical elements such as make specific data stand out and improve theoverall appearance of the report.

4. The prevents truncation of text objects to allow the text box to expand verticallyto fit all text and data from embedded fields.

5. To reduce the amount of time spent formatting reports by using fields that contain pre-builtfunctions, use .

Fundamentals of Report Design—Learner’s Guide166

Page 183: BOC310 en Col91 FV Part Ltr Marca

Lesson summaryAfter completing this lesson, you are now able to:

• Add graphical elements• Combine text objects with database fields• Apply specialized formatting• Insert fields with pre-built functions

167Formatting a Report—Learner’s Guide

Page 184: BOC310 en Col91 FV Part Ltr Marca

Fundamentals of Report Design—Learner’s Guide168

Page 185: BOC310 en Col91 FV Part Ltr Marca

Lesson 6Applying Section Formatting

Lesson introductionAdditional formatting options can be applied to entire sections of a report.

After completing this lesson, you will be able to:

• Format sections• Create a summary report

169Applying Section Formatting—Learner’s Guide

Page 186: BOC310 en Col91 FV Part Ltr Marca

Formatting sectionsYou can create multiple sections within an area on the report.

After completing this unit, you will be able to:

• Define the Section Expert• Format sections

Defining the Section Expert

The Section Expert offers flexibility when formatting different sections of a report.

The three tabs that always appear in the Section Expert are:• Common tab• Paging tab• Color tab

A fourth tab, the Layout tab, appears when you select the details section and the Format withMultiple Columns option on the Common tab.

To open the Section Expert

1. Click Section Expert on the Expert Tools toolbar.You can also right-click on the report and click Section Expert from the shortcut menu.

Exploring the Common tab

Use theCommon tab to set properties such as: visible, keep together, formatting withmultiplecolumns, and so on for a desired section.

The active options on the Common tab vary, depending on which section is selected in theSections list. Only options applicable to the selected section are available.

Note: TheConditional Formatting button enables you to add a formula that applies a conditionto the selected feature. The formula is processed when the condition is met in the report data.

Fundamentals of Report Design—Learner’s Guide170

Page 187: BOC310 en Col91 FV Part Ltr Marca

The options in the Common tab are:• Hide (Drill-Down OK)

Hide in theCommon tab functions the sameway asHide (Drill-DownOK) on the shortcutmenu. It prevents the area/section from printing, but still allows the user to double-click asummary field to open a new display tab to show the underlying data that constitutes thatsummary value.

• Suppress (No Drill-Down)

This option has the same effect asHide. You may not want to let your viewers drill downon the summary fields to see the information behind them. Or perhaps you do not wantpeople to inadvertently drill down. Choosing Suppress (No Drill-Down) still hides thesection, but does not allow anyone to see the underlying data. If a user double-clicks whenthemagnifying glass appears, the program produces a new tab, but the details do not show.Only the summary field is duplicated. You can alsomake this feature conditional by clickingthe formula button then entering a Boolean formula.

• Print at Bottom of Page

This option forces whatever is in that section to be printed as low on the page as possible.In a report that generates invoices, for example, you would want each invoice to have thetotal printed at the bottom of the page. That way, all invoices have the total printed in thesame place, no matter how many entries are on the invoice. This command can be madeconditional by clicking the formula button then entering a Boolean formula.

• Keep Together

This option prevents page breaks from spreading data from a single record over two pages.Therefore, if you havemultiple lines in theDetail section, all the information for each detail

171Applying Section Formatting—Learner’s Guide

Page 188: BOC310 en Col91 FV Part Ltr Marca

linewould stay together on one page if you turn theKeepTogether option on. This commandcan be made conditional by clicking the formula button then entering a Boolean formula.

• Suppress Blank Section

This command suppresses or prevents printing of the section if all fields in that section areblank. A typical use is in the creation of a mailing label report where there is no secondaddress line and you do not want a gap to print. This command can be made conditionalby clicking the formula button then entering a Boolean formula.

• Underlay Following Sections

Underlay allows any objects that are in the section to flow into the next while allowingobjects from the next section to print on top of the first. This command can be madeconditional by clicking the formula button then entering a Boolean formula.

You might place the company logo in the Page Header and turn on Underlay FollowingSections for the PageHeader to create awatermark effect. This command is often usedwithsections containing charts.

• Format with Multiple Columns

This option is activated only when theDetails section is chosen. This option enables you tocreate a report that shows the details in columnar format rather than having the details allshow one under the other. An example is address labels.

• Clamp Page Footer

When this check box is selected, the program removes any extra white space at the bottomof a report. This minimizes unnecessary scrolling for reports viewed online.

Note: This option appears only when you have selected Page Footer in the Sections list.

• Reserve Minimum Page Footer

This option enables you to minimize the space reserved for your Page Footer sections,thereby maximizing the space available for valuable report information on each page. Thisoption only affects a Page Footer area with multiple sections.

By default, Crystal Reports reserves space at the bottom of each page for your Page Footersections. This space is reserved whether or not the Page Footer sections are conditionallysuppressed. Normally, the space reserved is equivalent to the combined height of all PageFooter sections that are shown or conditionally suppressed.

You can, however, minimize the space reserved. To do so, first conditionally suppressindividual Page Footers as desired. Then select Page Footer in the Sections area of theSection Expert, and select the Reserve Minimum Page Footer option on the Expert’sCommon tab. When you do this, Crystal Reports will only reserve space on each page forthe tallest of your Page Footer sections.

Note: This option appears only when you select Page Footer in the Sections list.

• Read-only

This optionmakes a section read-only and locks the formatting and position of all the reportobjects it contains so they can’t be formatted or moved. When you select this option, all

Fundamentals of Report Design—Learner’s Guide172

Page 189: BOC310 en Col91 FV Part Ltr Marca

other choices in the Section Expert become inactive. The formatting options that are usuallyavailable on the toolbars or shortcut menus are also suppressed for that section.

• Relative Positions

This option allows you to lock the relative position of a report object next to a grid objectwithin a section.○ Only horizontal locking is possible. If you need to preserve relative vertical positioning,

you should create a new report section.○ Once Relative Positions is selected for a section, you can no longer drag objects to new

positions within that section. To change an object's position, use the Object Size andPosition dialog box.

○ Relative positioning applies only to objects placed to the right of grid objects (that is,objects that can grow horizontally).

Note:• Only horizontal locking is possible. If you need to preserve relative vertical positioning,

you should create a new report section.• Once Relative Positions is selected for a section, you can no longer drag objects to new

positions within that section. To change an object's position, use the Object Size andPosition dialog box.

• Relative positioning applies only to objects placed to the right of grid objects (that is,objects that can grow horizontally).

The Conditional Formatting button enables you to add a formula that applies a conditionto the selected feature. The formula is processed when the condition is met in the reportdata.

Exploring the Paging tab

Use the Paging tab to set properties such as: page breaks, page numbers, orientation, and soon for a desired section.

The options in the Paging tab are:

173Applying Section Formatting—Learner’s Guide

Page 190: BOC310 en Col91 FV Part Ltr Marca

• New Page Before

New Page Before is an available format property for Group (header and footer) and Detailssections. When you select this option, the program inserts a page break before it prints thesection. The page break thus comes before:○ The group (if using the option with a Group footer section).○ Each report record (if using the option with a Details section).

The Page Header and Page Footer appear on each page. If you have a subtotal or summaryfield in a Group Footer section, you can use the New Page Before option to put these valueson pages following the value being totaled.

Tip: In order to avoid blank pages, use the conditionsNot OnFirstRecord andNotOnLastRecordwithNew Page Before orNew Page After.

• Reset Page Number After

This option causes the page number to return to one after the section is complete. Normally,this feature is applied to a Group Footer. Therefore, if one group spans several pages, yousee page 1, page 2, and so on, of the group. Then, when Crystal Reports goes to the nextgroup, you see page 1, page 2, and so on, again.

• New Page After

When the End of Section check box is selected, the program inserts a page break after thesection.○ The Page Header and Page Footer appear on each page.○ Use New Page After in the Group footer section to print each group on a separate page.

When the Visible Records check box is selected, the program inserts a page break after aspecific number of records.

Fundamentals of Report Design—Learner’s Guide174

Page 191: BOC310 en Col91 FV Part Ltr Marca

Note:• This feature applies only to visible records. Suppressed records may be contained on a

page, but will not count toward visible records.• This option appears only when you have selected the Details section in the Sections list.

• Orientation

Allows you to set page orientation for each section in the report except for the Page Headerand Page Footer. The default setting will be the same as the report page orientation in thePage Setup dialog box.

Note: Once changed from the default setting, section page orientation will not be affectedby any further changes to the report page orientation.

Note: In order to avoid blank pages, use the conditionsNotOnFirstRecord andNotOnLastRecordwithNew Page Before orNew Page After.

Exploring the Color tab

Use the Color tab to set the background color for the desired section.

The options in the Color tab are:• Background Color

To add a background color to the selected section, select this check box, then choose a colorfrom the list.

• Conditional Formula

Click this button if youwant to set up a conditional formatting formula for the correspondingproperty.

175Applying Section Formatting—Learner’s Guide

Page 192: BOC310 en Col91 FV Part Ltr Marca

Exploring the Layout tab

Use the Layout tab to set up your report in a multi-column format. That is, instead of havingthe data print straight down the page, you can set upmultiple columns and have the data flowfrom column to column. You can also have your data print across then down the page, printingone record in each column, then printing a second record in each column, then a third, and soon. The dialog box is divided into four smaller boxes.

The options in the Layout tab are:• Detail Size

This box enables you to specify the dimensions (height and width) of one detail. Determinehow wide you want each detail to be (based on number of characters, font size, and so on)and enter that value in the Width edit box.

Determine how high youwant each detail to be (based on number of lines in the detail, fontsize, and so on) and enter that value in the Height edit box.

• Gap between details

This box enables you to specify the empty area (gap, gutter, and so on) you want to allowbetween details. Horizontal = the gaps between details going across the page, Vertical = thegaps between details going down the page.

Determine the gaps you want to allow. Enter the horizontal gap in the Horizontal edit boxand enter the vertical gap in the Vertical edit box.

• Printing direction

The Printing direction box enables you to specify the path the program followswhen printingthe details on a report page. Your options are:○ Across then Down

Fundamentals of Report Design—Learner’s Guide176

Page 193: BOC310 en Col91 FV Part Ltr Marca

Prints details across the columns, one detail in the first column, one in the next, one inthe next, and so on. Then, when all the columns have a detail, the programmoves downthe page and prints a second detail in the first column, then in the second, and so on.

○ Down then Across

Prints details down the first column, then down the second column, and so on.

• Format groups with multiple column

Select this check box if youwant the program to format groupswithmultiple columns usingthe Width, Gap between Details, and Printing Directions specified for the selected section.

Formatting a section

Whenwould you usemultiple sections in your report? Perhaps youwant to display a standardset of details and additional details if there is an outstanding invoice. You can place the standarddata in Details a and leave it at the default to always print. Then you can place the invoicingdata in Details b and formatDetails b to print only when there is an outstanding invoice.

Or youmay have a report grouped by region that includes some international groups. You cancreate a secondGroup Header section and useGroup Header a to display group values forUS customers by conditionally formatting it. Then, you could conditionally formatGroupHeader b to display only the international customers.

To insert a new section

1. In the Section Expert, select the section or area you want to insert a section after.

2. Click Insert.

The program adds a new section immediately below the selected section.

3. ClickOK.

To move sections

1. In the Section Expert, select the section you want to work with.

2. Click the Up arrow orDown arrow.

You can only move a section up or down within an area.

3. ClickOK.

To merge sections

1. In the Section Expert, move the sections so the two sections follow each other in the list.

2. Select the top section.

3. Click theMerge button.

177Applying Section Formatting—Learner’s Guide

Page 194: BOC310 en Col91 FV Part Ltr Marca

The program merges the selected section with the section below. Any data in the sectionbelow is combined with the section above; you do not lose any data.

4. ClickOK.

You may need to rearrange the objects in the newly merged section.

To delete a section

1. In the Section Expert, select the section you want to delete.

2. ClickDelete.The selected section is deleted.

3. ClickOK.

Tip: When you want to delete a section and its contents, use theDelete section option.When a section contains objects and you want to combine the data with data in anothersection, use theMerge section option.

Tip: When you want to delete a section and its contents, use theDelete section option.When a section contains objects and you want to combine the data with data in anothersection, use theMerge section option.

To select a background color

1. In the Section Expert, select the Background Color check box on the Color tab.

The color list is activated.

2. Click the arrow on the color list to display the available colors.

Fundamentals of Report Design—Learner’s Guide178

Page 195: BOC310 en Col91 FV Part Ltr Marca

3. Select a color from this list to make the background color of the selected section absolute.

Activity: Formatting sections

Objective

• Use the Section Expert to format sections.

Instructions

1. Use the starting point report, Sections-1.rpt.

2. Suppress the Page Footer, Report Footer, andGroup Footer #2 sections.

3. Format every country to print on a separate page.

4. Format the background color of theRegionGroupHeader andDetails section to printwitha silver background.

5. Resize the Region Group Header 2 to allow for more space.

6. Save the report as Formatting sections.rpt.

7. Add the report into the folder in theWorkbench.Your report should look similar to this example.

179Applying Section Formatting—Learner’s Guide

Page 196: BOC310 en Col91 FV Part Ltr Marca

Creating summary reportsA summary report includes only one summary line for each group in the report. In a summaryreport, the detail is hidden from the viewer, but can be made accessible through drill-down.

After completing this unit, you will be able to:

• Define a summary report• Create a summary report

Defining a summary report

The reports that you have created so far are detailed reports that include all lines of detail.However, you can create different types of reports. For example, perhaps a manager is onlyinterested in summary information such as the total sales for a region. A summary report iseasily created from a detail report. In order to be able to create a summary report, you mustfirst have at least one group defined on your report, as well as a summary field. Then, youneed to hide theDetails section so you only see the group information.

When you create a summary report, you can choose to enable users to drill down on summaryinformation to access the underlying data. Drill-down is the capability to double-click a summaryfield and open a new window tab to show the behind-the-scenes data that makes up thatsummary. From the Section Expert you have the choice toHide or Suppress a Details section.

Creating a summary report

The options in the Section Expert that are applicable to creating a summary report are:• Hide (Drill-Down OK)

When Hide (Drill-Down OK) is selected, the cursor changes into a magnifying glasswhenever you are in a summary report and you move the mouse pointer over a summaryfield. Double-click to see the data that makes up that summary. WithHide (Drill-DownOK) enabled, viewers can access the data underlying the summary information.

• Suppress (No Drill-Down)

You may not want to allow your viewers to drill down on the summary fields to see theinformation behind them, or to inadvertently drill down. Choosing Suppress (NoDrill-Down) still hides the section, but does not allow anyone to see the underlying data.The magnifying glass still appears. If the user double-clicks when the magnifying glassappears, the system produces a new tab, but the details will not show. Only the summaryfield will be duplicated.

Tip: Drill-down capabilities are also available with charts. The same functionality worksin summary reports, because they are both based on summary fields.

Fundamentals of Report Design—Learner’s Guide180

Page 197: BOC310 en Col91 FV Part Ltr Marca

Viewing the summary report in the Preview window

When you view a summary report in the Previewwindow, the cursor changes to amagnifyingglass whenever it moves across a part of the report that represents a summary.

When you double-click with this magnifying glass, a new report window preview tab opensand the details behind that summary are displayed.

You can double-click as many summaries as you need, and each one opens its own previewtab. You can close any of these drill-down tabs at any time by viewing that tab, and then clickingthe close tab button.

To create a summary report

1. Click Section Expert on the Expert Tools toolbar.

2. Select theDetails section and checkHide (Drill-DownOK) or Suppress (No Drill-Down)option, depending on the requirements of the report.Both options prevent theDetails section from printing when viewing the report.

3. ClickOKwhen you are finished to create the summary report.

4. Preview your report.You now have only summary information displayed.

Tip: After you hide theDetails section to create a summary report, youmaywant to formatthe report so that the column headings labeling detailed information are displayed in thedrill-down tab rather than in the Preview tab. To do so:

• Move theGroup Name field from theGroup Header section into theGroup Footersection.

• Move the column headings from the PageHeader section into theGroupHeader section.• Hide theGroup Header section.

Activity: Creating a summary report

Objective

• Display only the summary information in a report.

Instructions

1. Use Formatting sections.rpt from the previous activity.

2. Remove theNew Page Before orNew Page After setting before creating the summaryreport so you can see multiple groups on each page.

3. Delete the Customer Name, Address1, and Phone Page Header column headings.

4. Resize theGroup Header and Footer to allow for more space, if needed.

181Applying Section Formatting—Learner’s Guide

Page 198: BOC310 en Col91 FV Part Ltr Marca

5. Change the format option in theDetails section so drill-down is not available.

6. Preview the report to test the suppression of the detail information.

7. Change the format option in theDetails section so drill-down is available.

8. Preview the report to test that detail information is still available when you drill down.

9. Save the report as Creating a summary report.rpt.

10.Add the report into the folder in theWorkbench.Your report should look similar to this example.

Fundamentals of Report Design—Learner’s Guide182

Page 199: BOC310 en Col91 FV Part Ltr Marca

Quiz: Applying section formattingExercise one

1. True or False: TheNew Page Before and theNew Page After option is usually used withGroup Headers andGroup Footers.

2. What option prevents page breaks from spreading data from a single record over two pages?

3. If youwant to lock the formatting and position of all report objects in a section, what optiondo you use in the Section Expert?

Exercise two

Answer these questions using Creating a summary report.rpt.

1. Who are the customers in the New South Wales region of Australia?

2. What is the street address for the Offroad Bike Verlieh in Berlin?

3. What is the phone number for the Picadilly Cycle in Greater London?

183Applying Section Formatting—Learner’s Guide

Page 200: BOC310 en Col91 FV Part Ltr Marca

Fundamentals of Report Design—Learner’s Guide184

Page 201: BOC310 en Col91 FV Part Ltr Marca

Lesson 7Creating Basic Formulas

Lesson introductionIf youwant to display data that is a calculated value, youmust create a formula field and placethat formula field on your report.

After completing this lesson, you will be able to:

• Define a formula and its purpose• Create formulas• Apply Boolean formulas• Apply If-Then-Else formulas• Apply date calculations• Apply numeric calculations• Apply string manipulation

185Creating Basic Formulas—Learner’s Guide

Page 202: BOC310 en Col91 FV Part Ltr Marca

Defining a formula and its purposeIn many cases, the data you want to appear on your report already exists in the database.Sometimes, however, your report requires data that is derived by manipulating data in anexisting field in the database. In this case, you would use a formula to manipulate the data,and a formula field to contain the manipulated data.

After completing this unit, you will be able to:

• Describe a formula• Describe the components of a formula• Explain Crystal syntax• Describe Crystal Reports data types• Work with formulas in the Field Explorer

Formulas

A formula is used to manipulate data in your report. For example, a formula can perform acalculation or change the field’s formatting. You can think of a formula as a small piece ofcomputer programming code that processes and prints its result on your report, just like adatabase field. It will print the result wherever you place the formula field.

You can write formulas that are as simple or complex as you need them to be. Understandingthe formula language helps you develop powerful and flexible formulas.

Typical uses for a formula include:• Calculating a percentage of a number.• Extracting a single character from a string field.• Combining a text string with a number or date field.• Finding the difference between two date fields.• Performing conditional logic.

The components of a formula

Formulas contain two critical parts: the components and the syntax (or syntax rules). Thecomponents are the pieces that you combine to create a formula. The syntax rules are used toorganize the components. You can use any of the components listed in your formula.

ExampleComponent

{Customer.Customer Last Name}, {Customer.Last Year’s Sales}Fields

1, 2, 3.1416Numbers

"Quantity", ":", "your text"Text

Fundamentals of Report Design—Learner’s Guide186

Page 203: BOC310 en Col91 FV Part Ltr Marca

ExampleComponent

+ (add), / (divide), -x (negate)

Operators are special symbols or words that describe an operationor an action to take place between two or more values. OperatorsOperatorsare used in formulas. The program reads the operators in a formulaand performs the actions specified.

ToText(x), ToNumber(x)

Functions are built-in procedures or subroutines used to evaluate,make calculations on, or transform data. Functions perform

Functions

calculations such as average, sum, and count. All functions availableare listed with their arguments and are arranged by their use.

When you specify a function, the program performs the set ofoperations built into the function without you having to specifyeach operation separately. In this way, a function is a kind ofshorthand that makes it easier and less time consuming for you tocreate reports.

cdFirstDayof Month, cdStatutoryHolidays

Custom functions provide a way to share and reuse formula logic.They can be stored in the BusinessObjects Enterprise RepositoryCustom functionsand then added to a report. Once in the report, custom functionscan be used in the Formula Expert when creating formulas.

"If" and "Select", "For" loops

Control structures control the flow of logic in a formula. You canuse them to build formula setting conditions, that, if met, triggerControl structuresspecific consequences or repeat a sequence of actions under certainconditions.

Average (fld, condFld), Sum (fld, condFld, "condition")

Group field values summarize a group. For example, you could usegroup field values to find the percentage of the grand totalcontributed by each group.

Group field values

{@GrossProfit}, {@QUOTA}Other formulas

Tip: When you select a function or operator in the appropriate tree, or when you select a functionor operator that is used in the body of your formula, you can press F1 to see help specific to thatfunction or operator.

187Creating Basic Formulas—Learner’s Guide

Page 204: BOC310 en Col91 FV Part Ltr Marca

Crystal syntax

Youwrite formulas according to a specific set of rules called syntax. The Formula Editor checksthe syntax and helps identify problems so you can fix them before you add the formula to thereport.

Syntax rules are used to create a correct formula. Some basic rules are:• Enclose text strings in quotation marks.• Enclose arguments in parentheses (where applicable).• Referenced formulas are identified with a leading @ sign.

When creating formulas, you have the option of using either Crystal syntax or Basic syntax.Almost any formula written with one syntax can be written with the other.

Note: You cannot use bothCrystal syntax and Basic syntax in the same formula; however, you canuse multiple formulas written in either syntax within the same report.

If you are already familiar with Crystal syntax, you can continue to use it and benefit from thewide range of functions, operators, and control structures.

If you are familiar with Microsoft Visual Basic or other versions of Basic, then working in theBasic syntax in Crystal Reports may be more comfortable for you. In general, Basic syntax ismodeled on Visual Basic except that it has specific extensions to handle reporting.

Report processing is not slowed down by using Basic syntax. Reports using Basic syntaxformulas can run on any machine that Crystal Reports runs on. Also, using Basic syntaxformulas does not require distributing any additional files with your reports.

Changing the syntax fromCrystal syntax toBasic syntax or going fromBasic syntax toCrystalsyntax changes the list of functions in the Functionswindow as well as the list of operators intheOperatorswindow. However, the available report fields remain the same since the reportfields are available to both syntaxes.

To set the default syntax type for your report

1. On the File menu, select theOptions command.

2. From the Formula Editor tab, use the Formula Language drop-down arrow to select eitherCrystal Syntax or Basic Syntax from the list.

Note: For the purposes of this lesson, the Crystal syntaxwill be used throughout theexamples.

Fundamentals of Report Design—Learner’s Guide188

Page 205: BOC310 en Col91 FV Part Ltr Marca

Special characters used in Crystal syntax

DescriptionCharacter

Denotes everything following is a comment and is ignored by theFormula Editor. You must repeat the // for each line you want tobe “commented out.”

//

Denotes the arguments that followa function.Many functions requiremore than one argument separated by a comma within the round

( )brackets. Can also denote precedence, forcing parts of your formulabetween the() to evaluate first.

Denotes fields. All types of fields, database, other formulas, special,and so on are enclosed in French braces.

{ }

Denotes subscript or arrays. Square brackets before a function denotean array,whereas square brackets after a function indicate a subscript(pulling specific characters from a string).

[ ]

Denotes literals. Any text between the quotes is printed as it appearsbetween the quotes. This functionality is useful when you want

" "punctuation, text, or special characters to appear as part of the result.Single quotation marks (‘ ’) can also be used for this purpose.

Upper or lower case is ignored by the Formula Editor. You can enteryour functions in all caps, all lower, or any mix you prefer.Upper/Lower case

Carriage returns are ignored in the Formula Editor. You can haveline breaks and blank lines almost anywhere in the formula. It isCarriage returns common practice to break up long formulas into chunks to makethem easier to read and edit.

Data types

When writing formulas in Crystal Reports, it is important to know the data types of the fieldsyou are working with:• Boolean• String• Date• Time

189Creating Basic Formulas—Learner’s Guide

Page 206: BOC310 en Col91 FV Part Ltr Marca

• DateTime• Number• Currency

All fields will be recognized as one of these data types. You must always be aware of the fielddata type since this can affect which functions can be used with the field.

Note: A field that is larger than 254 characters will be recognized as a memo field. Formulas canwork with memo fields, and they can process strings up to 64K in length.

Working with formulas in the Field Explorer

From the Field Explorer dialog box, you can:• Create a new formula.• Edit an existing formula.• Rename an existing formula.• Delete a formula.

To create a new formula

1. From the Viewmenu, select Field Explorer.The Field Explorer dialog box appears.

2. Right-click the Formula Fields tree and selectNew from the shortcut menu.

3. Type the name of the formula, and then clickOK.

Note: The formula name is used as the column heading and is limited to 254 characters.

To edit an existing formula

1. From the Viewmenu, select Field Explorer.The Field Explorer dialog box appears.

2. Right-click the formula you want to edit and choose Edit.The Formula Workshop appears.

3. In the Formula Editor area, edit the formula.

4. Click the Check toolbar button to identify any errors in the formula.

5. Fix any syntax errors the Formula Checker identifies.

6. When the formula has the correct syntax, click Save and Close on the Formula Workshoptoolbar.You return to the Field Explorer dialog box.

Fundamentals of Report Design—Learner’s Guide190

Page 207: BOC310 en Col91 FV Part Ltr Marca

To rename an existing formula

1. From the Viewmenu, click Field Explorer.The Field Explorer dialog box appears.

2. Right-click the formula you want to edit and select Rename from the shortcut menu.

3. Type the new name for the formula, and then press Enter or click off the field.The formula has been renamed.

Deleting a formula

When a formula is created and added to a report, the Report Designer:• Stores the specification for creating the formula, using the name you assigned to it.• Places a working copy of that formula at the point you specify in the report. A working

copy is any occurrence of the formula in the report.

In order to completely delete a formula, you must delete the specification and all workingcopies of the formula. You cannot delete the specification without deleting all working copiesof the formula.

Even after the working copies of a formula have been deleted from the report, the formulaspecification remains unchanged. The specification is listed in the Field Explorer dialog box.It is available if you want to enter the formula in the report again. A formula cannot be deletedfrom this list if it is referenced by another formula on the report.

To delete a formula

1. In the Report Designer, right-click the formula field you want to delete and selectDeletefrom the shortcut menu.

To delete the formula specification

1. Choose View from the main menu and select Field Explorer.The Field Explorer dialog box appears.

2. In the Field Explorer, right-click the formula you want to delete and chooseDelete.

Note: A dialog box appears if this formula is currently in use in a report. If you delete thisformula, you will delete all references of it in reports. Click Yes to delete.

191Creating Basic Formulas—Learner’s Guide

Page 208: BOC310 en Col91 FV Part Ltr Marca

Creating formulasCreating basic formulas to include in your report will enhance its usefulness. You can createformulas in Crystal Reports using either Crystal syntax or Basic syntax.

Note: This course uses Crystal syntax exclusively.

After completing this unit, you will be able to:

• Define the methods to create formulas• Create a formula using the Formula Workshop• Create a formula using the Formula Editor

Formula creation methods

You can create a formula using these methods:• Formula Workshop

You can create most kinds of formulas in the Formula Workshop. The workshop consistsof a toolbar, a tree that lists the types of formulas you can create or modify, and an area fordefining the formula itself.

• Formula Editor

The Formula Editor is a component of the Formula Workshop. Use the Formula Editor tocreate and modify the content of formulas.

• Formula Expert

The Formula Expert is a component of the Formula Workshop. Use the Formula Expert tocreate and modify formulas based on custom functions.

Note: Only the Formula Workshop and the Formula Editorwill be discussed in this course.

Adding comments to a formula

When you create a formula, always include comments in the formula itself. Formula commentsare notes included with a formula to explain its design and operation. Comments do not printand they do not affect the formula, but they appear in the Formula Workshop. You can usecomments to explain the purpose of a formula or explain the steps involved inwriting it. Theseexplanations or descriptions of your formulas will help you or others if, after a period of time,the formula needs to be modified.

Comments begin with two forward slashes (//) and are followed by the text of the comment.Everything that follows the slashes on the same line is treated as being part of the comment.

Creating a formula in the Formula Workshop

There are many ways to access the FormulaWorkshop. You see it when you add new formulafields, when you define selection formulas, when you work with custom functions, and so on.

Fundamentals of Report Design—Learner’s Guide192

Page 209: BOC310 en Col91 FV Part Ltr Marca

You can open the Formula Workshop by itself before you begin adding specific kinds offormulas.

Workshop Tree

TheWorkshopTree contains folders for each type of formula you can create in Crystal Reports.It also contains folders for custom functions and SQL Expressions. If the workshop appears asthe result of using a specific command (for example, you’ve selected the Record command onthe Selection Formulas submenu), the appropriate folder in the tree is selected, and theappropriate version of the Formula Editor appears.

Expand any folder in the tree to see the formulas that already exist. New formulas can be added,and existing formulas can be edited or deleted as needed.

Tip: TheWorkshop Tree can be docked. By default, it appears docked on the left-hand sideof the FormulaWorkshop, but you canmanually dock it on the right-hand side. In free-floatingmode, theWorkshop Tree can be dragged to any location in the workshop.

Formula Workshop buttons

Themain toolbar in the FormulaWorkshop is made up of three smaller toolbars. Each of thesetoolbars contains a set of buttons that is relevant to specific actions: working with the FormulaWorkshop as awhole, workingwith theWorkshopTree, orworkingwith an editor. Individualbuttons are available or unavailable based on the task you are undertaking. Each toolbar canbe moved and docked as you require.

The buttons for theGeneral toolbar of the FormulaWorkshop perform the following functions:

Save andClose: Closes the FormulaWorkshop after prompting you to save thechanges. If you save changes, your formula is checked for errors.

Save: Saves the formula, SQL Expression, or custom function.

New: Creates a new formula of the type selected from the list. Also used to createa new custom function or SQL Expression.

Hide/Show workshop tree: Shows or hides the Workshop Tree.

Toggle properties display: Toggles display between Custom Function Editorand Custom Function Properties dialog box. Custom functions and formulas(where possible) are displayed in the selected mode until the button is clickedagain.

Use Expert/Editor:

Opens the Formula Expert. Use the Formula Expert to help you createa formula based on a custom function.

Note: This button is not available when creating a custom function.

Help: Opens onlineHelp for the Formula Workshop dialog box.

193Creating Basic Formulas—Learner’s Guide

Page 210: BOC310 en Col91 FV Part Ltr Marca

The buttons for theWorkshop Tree toolbar of the Formula Workshop perform the followingfunctions:

Duplicate: Makes a copy of the formula that you have selected. When the copyis created, you can rename it and edit it.

Rename: Lets you rename the selected formula, custom function, or SQLExpression.

Delete: Deletes the selected formula, custom function, or SQL Expression.

Expand Node: Expands or collapses the selected node in theWorkshop Tree.Also works with multiple node selections.

Show Formatting Formula Nodes Only: Shows or hides report object nodes inthe Formatting Formulas folder if the objects do not have formulas associatedwith them.

Add to Repository: Opens theAdd Custom Function to Repository dialog boxso you can select a repository to add the custom function to.

Add to Report: Adds the selected repository custom function to the report.

The buttons for theExpressions Editor toolbar of the FormulaWorkshopperform the followingfunctions:

Check: Tests the syntax of the formula or custom function and identifies syntaxerrors if they are found.

Undo: Undoes the last action performed.

Redo: Redoes the last action.

Browse Data: When you select a field from theReport Fieldswindow and clickthe Browse Data button, a dialog box appears with a list of the values for theselected field.

View values for the selected field and select individual values toinsert into your formula.

Note: This button is not available for custom functions.

Find or Replace: Searches the Formula Editor for a specified word, number, orformula string.

Toggle Bookmark: Inserts a bookmark at the beginning of a selected formulaline. Click the button again to remove the bookmark.

Next Bookmark: Jumps to the next bookmark.

Fundamentals of Report Design—Learner’s Guide194

Page 211: BOC310 en Col91 FV Part Ltr Marca

Previous Bookmark: Jumps to the previous bookmark.

Clear All Bookmarks: Deletes all bookmarks in the current formula.

Sort trees: Arranges all Report Fields, Functions, andOperators trees inalphabetical order.

Field tree:

Hides or views the Report Fields tree.Note: This button is not available for custom functions.

Function tree: Hides or views the Functions tree.

Operator tree: Hides or views the Operators tree.

Find results: Hides or views the result set of a global formula search.

Syntax: Allows you to select Crystal syntax or Basic syntax as your formulasyntax.

Allows you to select Exceptions For Nulls orDefault Values For Nulls as amethod for dealing with null values in your data.

Comment/Uncomment: Comments out the highlighted selection of a formula.Commented lines are not evaluated as part of the formula.

When writing formulas, remember these considerations:• The onlineHelp file contains explanations and examples of all functions within Crystal

Reports. This file can be accessed from the menu as well as theHelp icon on the toolbar inthe Formula Editor.Within the onlineHelp, you can select the Index tab and enter the nameof a function. The program returns an explanation of the function you entered.

• If you need the search and replace functionality within the Formula Editor, you can clickthe Find or Replace icon on the toolbar in the Formula Editor. Select the Edit Text searchoption to access the search and replace functionality.

• You can create new formulas quickly within the Formula Workshop by clicking theNewbutton on the Formula Workshop toolbar.

• You can switch between formulas by navigating through theWorkshopTree on the left-handside of the Formula Workshop.

• You can change the default syntax type for Crystal Reports formulas when you select theformula language syntax from the list in theReporting tab of theOptions dialog box underthe Filemenu. This setting is a global option; however, you can still change the formulasyntax for your formulas on an individual basis in the Formula Workshop.

195Creating Basic Formulas—Learner’s Guide

Page 212: BOC310 en Col91 FV Part Ltr Marca

To access the Formula Workshop

1. On the Reportmenu, click Formula Workshop.Alternately, you can click the Formula Workshop button on the Expert Tools toolbar.

The Formula Workshop appears.

2. Click the drop-down arrow on theNew button and select the type of formula you want tocreate.The appropriate editor or dialog box appears.

Creating a formula in the Formula Editor

The Formula Editor is a component of the FormulaWorkshop. Using the Formula Editor, youcombine fields, operators, and functions together to create a working formula. The FormulaEditor enables you to type the components of the formula directly.

Select the various functions, operators, group field values, and other formulas from the availablelists. By double-clicking the item, Crystal Reports inserts it into the formula for you. In theFormula Editor, you can customize your settings with dockable and resizable framewindows,bookmarks, drag anddrop, and search and replace. The Formula Editorhas fourmainwindows:

Description of contentsWindow

Report fields contain all database fields accessible for your report.They also contain any formulas or groups already created for thereport.

Report Fields

Functions are prebuilt procedures that return values. Theyperform calculations such as average, sum, count, sin, trim, anduppercase. Custom functions are also listed in this window.

Functions

Operators are the "action verbs" you use in formulas. Theydescribe an operation or an action to take place between two ormore values. Examples: add, subtract, less than, and greater than.

Operators

Fundamentals of Report Design—Learner’s Guide196

Page 213: BOC310 en Col91 FV Part Ltr Marca

Description of contentsWindow

Area where you create a formula.Formula text window

Note: Use File ➤ Options ➤ Formula Editor tab to set the default text font and font size.

To create a formula using the Formula Editor

1. In the Formula Workshop, clickNew ➤ Formula.

2. In the FormulaName dialog box, enter the name youwant to identify the formula, and thenclickOK.The Formula Editor appears inside the Formula Workshop.

3. Enter the formula by typing in the components or selecting them from the component trees.

Tip:

• Ctrl + Space brings up a list of available functions. If you have already started typing, itbrings up a list of keywords that are possible matches for what you have already typed.

• A list of available fields automatically appears when you enter an open brace bracket.Ctrl + Space brings up the list again if you previously pressed Esc to clear it.

4. Click Check to identify any errors in the formula.

5. Fix any syntax errors the Formula Checker identifies.

6. When the formula has the correct syntax, click Save and Close on the Formula Workshoptoolbar.

7. In the Field Explorer, select (single-click) the formula, click Insert to Report, and thenposition the cursor where you want the formula to appear on your report.

8. Click once to set the field in the desired position on the report.

A formula that is placed on a report is indicated by @ (for example, @ProcessTime) on theDesign tab.

Note: You can also use drag-and-drop to add a formula to your report.

197Creating Basic Formulas—Learner’s Guide

Page 214: BOC310 en Col91 FV Part Ltr Marca

Applying Boolean formulasBoolean formulas incorporate the operators and, or, and not and are used when you want tosignal a condition of true or false.

After completing this unit, you will be able to:

• Describe a Boolean formula• Create a Boolean formula

Boolean formulas

A Boolean formula always returns a value of True or False. The result of a Boolean formulacan be displayed as:• True or False• T or F• Yes or No• Y or N• 1 or 0

You can change how a Boolean value displays in your report by right-clicking the value andselecting the Format option. You then have the option to display it as 1 or 0, Y or N, Yes or No,True or False, or T or F.

You can use Booleans to check for conditionswithin a field. For example, to determinewhetheran order amount matches a certain condition, you would write a formula like this:{Orders.Order Amount} > 5000

Creating a Boolean formula

Boolean operators are used to create conditions that require a logical relationship between twoor more values. Conditions that use Boolean operators are called Boolean expressions.• A and B means that both A and B must be true for the condition to be satisfied (to return a

True value).• A or B means that either A or B (or both) must be true for the condition to be satisfied (to

return a True value).

Several useful examples of Boolean operators are:• And

• Or

• Not

And

The And operator joins the value of x and y. The And operator takes two expressions that evaluateto a Boolean. The expression evaluates True only if both x and y are true. All other combinationsresult in a value of False.

Fundamentals of Report Design—Learner’s Guide198

Page 215: BOC310 en Col91 FV Part Ltr Marca

x and yValue of yValue of x

TrueTrueTrue

FalseFalseTrue

FalseTrueFalse

FalseFalseFalse

Some examples include:

DescriptionCode

Returns True, where A = 10, B = 6, and C = 3 (bothconditions are true). Returns False, where A=10, B=6,and C=7 (only one of the two conditions are true).

A > B and B > C

Returns True, where A = 7, B = 5, C = 3, D = 2, E = 10 (allthree of the conditions are true).

(A>B) and (A * C - D > E)and (E / D <= B)

Or

The Or operator takes two expressions that evaluate to a Boolean. If either expression evaluatesTrue, the operator returns True. If both expressions evaluate False, the operator returns False

x and yValue of yValue of x

TrueTrueTrue

TrueFalseTrue

TrueTrueFalse

FalseFalseFalse

199Creating Basic Formulas—Learner’s Guide

Page 216: BOC310 en Col91 FV Part Ltr Marca

Some examples include:

DescriptionCode

True, where A = 10, B = 6, and C = 3 (both conditions true).A > B or B > C

True, where A=10, B=6, and C=7 (either one of the twoconditions true).

A > B or B > C

False, where A=5, B=6, and C=7 (neither of the two conditionstrue).

A > B or B > C

True, where A = 5, B = 5, C = 3, D = 2, E = 12 [at least one of thethree conditions is true. In this case only (A * C - D > E) is true].

(A > B) or (A * C - D > E) or (E / D<= B)

Not

The Not operator reverses the True or False value of x.

Not xValue of x

FalseTrue

TrueFalse

• Not (Not(False)) = False

• Not (Not(True)) = True

Some examples include:

DescriptionCode

If A=5, B = 4, C = 3, the expression (A>B and B>C) is True.Both conditions tied together by the Boolean operator Andnot (A > B and B > C)are True; thus, the entire statement has a value of True. TheNot operator changes the value of the expression to False.

If A=3, B = 4, C = 3, the expression (A>B and B>C) is False.One of the two conditions tied together by the Boolean

not (A > B and B > C) operator And is False; thus, the entire statement has a valueof False. The Not operator changes the value of theexpression to True.

Fundamentals of Report Design—Learner’s Guide200

Page 217: BOC310 en Col91 FV Part Ltr Marca

Activity: Applying a Boolean formula

Objective

• Create a Boolean formula.

Instructions

1. Open Basic Formulas-1.rpt as the starting point report for this activity.

2. If you want to see the entire report in a horizontal view, click File ➤ Page Setup, and thenselect Landscape.

3. Add a Boolean formula named Check for USA, that evaluates the data in the Country fieldand determines if it is equal to USA.

4. Preview the report.

5. Either True or False should be displayed in the Check for USA field.

6. Format the Check for USA formula to display Yes or No rather than True or False.

7. Use the Format Painter to format the column heading to be vertical text, that is, rotate thetext.

8. Save the report as Applying a Boolean formula.rpt.

9. Add the report into the folder in theWorkbench.Your report should look similar to this example.

201Creating Basic Formulas—Learner’s Guide

Page 218: BOC310 en Col91 FV Part Ltr Marca

Applying If-Then-Else formulasThe If-Then-Else type formula is a conditional formula. That is, if a condition is met, then acertain action will be taken. If the condition is not met, then some different action takes place.

After completing this unit, you will be able to:

• Describe an If-Then-Else formula• Create an If-Then-Else formula

If-Then-Else formulas

If-Then-Else formulas can check for asmany conditions as required in order for you to achievethe results you need.

If-Then-Else formulas have three parts:• If sets the condition or test.• Then sets the action to be taken if the condition is met, that is, if the test returns a true value.• Else is optional. It sets the action to be taken if the condition is not met, that is, if the test

returns a false value.

Creating an If-Then-Else formula

Suppose you want to display a rating beside each customer’s order figures in an orders reportdepending on the level achieved: high orders or low orders. You can accomplish a task suchas this by using an If-Then-Else formula.If {Orders.Orders Amount}>40000 Then "high orders"Else "low orders"

Tip: The data type must be the same for the Then and Else parts of the formula (text, numeric,date). For example, if the Then part of the formula prints a text string, the Else part of the formulamust also print a text string.

Activity: Applying an If-Then-Else formula

Objective

• Create an If-Then-Else formula.

Instructions

1. Use the Applying a Boolean formula.rpt.

2. Add the formula,Domestic or International, which displays “Domestic” beside Countryequal to USA and “International” beside all others.

3. Format the column heading to be vertical text, that is, rotate the text.

Fundamentals of Report Design—Learner’s Guide202

Page 219: BOC310 en Col91 FV Part Ltr Marca

4. Save the report as Applying an If-Then-Else formula.rpt.

5. Add the report into the folder in theWorkbench.Your report should look similar to this example.

203Creating Basic Formulas—Learner’s Guide

Page 220: BOC310 en Col91 FV Part Ltr Marca

Applying date calculationsA database field can contain a date value, which is recognized as date only, time only, ordate-time.

After completing this unit, you will be able to:

• Describe a date calculation• Create a date calculation

Date calculation

Date functions allow you to convert numbers to dates, which you then can format to displayas appropriate, and to convert dates to numbers.

Creating a date calculation

Examples of calculations using date or date/time fields are:• Current date function• Addition and subtraction• Year, month, and day functions

Current date function

To have today’s date appear on a report, use the current date function. For example, to displaytoday’s date in your report, you would write this formula:CurrentDate

Addition and subtraction

You can add days to date fields by adding a number. For example, if you know an order shouldbe shipped five days after the order was placed, you would find the expected ship date withthis formula:{Orders.Order Date} + 5

If the Orders.Order Datewas January 10, then this formula would return January 15.

You can also subtract days from date fields by subtracting a number. For example, if you wantto find the number of days it took to ship an order, if the order date was five days prior to theship date, you would use the formula:{Orders.Order Date} - 5

If the Orders.Order Datewas January 10, then this formula would return January 5.

The most useful application of these concepts is finding the difference in days between twodate fields. For example, if you want to find the number of days it took to ship an order, youwould use this formula:{Orders.Ship Date} - {Orders.Order Date}

Fundamentals of Report Design—Learner’s Guide204

Page 221: BOC310 en Col91 FV Part Ltr Marca

If the Orders.Ship Datewas January 20 and the Orders.Order Datewas January 10, then thisformula would return 10 days.

Year, month, and day functions

At times, you may need to extract the year, month, or day portions from a date field. Toaccomplish this task, youwould use the Year ( ), Month ( ), or Day ( ) function. For example,if you were looking for monthly trends in your ordering cycle, you could use the Month ( )function to extract the month portion of your order date fields using this formula:Month ({Orders.Order Date})

If the Orders.Order Datewas January 10, then this formula would return 1.00.

Tip: Commas and decimal places are the default display for numbers in Crystal Reports.

Activity: Applying date calculations

Objective

• Create date calculation formulas.

Instructions

1. Use the Applying an If-Then-Else formula.rpt.

2. Add a formula namedOrder Process Time that displays the number of days to processeach order from the time it was ordered to the time it was shipped.

3. Format theOrder Process Time to display with no decimal places.

4. Add the formula,Month Ordered, which displays the month in the form of a number 1 to12. This formula is useful if you want to establish trends of the busiest order months overseveral years.

5. FormatMonth Ordered to display with no decimal places.

6. Add the formula,Days Since Shipped, which displays the number of days between theship date and today. The values returned by this formula will change due to the currentdate on the actual computer being used.

7. FormatDays Since Shipped to display with no decimal places.

8. Remove the Country group.

9. Save the report as Applying date calculations.rpt.

10.Add the report into the folder in theWorkbench.

205Creating Basic Formulas—Learner’s Guide

Page 222: BOC310 en Col91 FV Part Ltr Marca

Your report should look similar to this example.

Fundamentals of Report Design—Learner’s Guide206

Page 223: BOC310 en Col91 FV Part Ltr Marca

Applying numeric calculationsSome fields contain numeric data that can be used in calculations.

After completing this unit, you will be able to:

• Describe a numeric calculation• Create a numeric calculation

Numeric calculations

Formulas using numeric fields perform mathematical computations on your data.

Creating a numeric calculation

Numeric calculations can include:• Arithmetic• Sum• Count• Distinct count

Arithmetic

Some arithmetic operators available for use in a formula are:• addition (+)• subtraction (-)• multiplication (*)• division (/)

For example, you can use themultiplication symbol to find the sales tax charged on a particularorder. If you wanted a sales tax amount of 7% on order amount field, the formula would looklike this:{Orders.Order Amount} * .07

Sum(number, field)

Summary fields are normally created using the Insert Summary dialog box. They then appearin the Available Fields tree, and can be used in a formula by double-clicking there. However,they do not need to be created in this way. You can create a summary field exclusively for useby your formula by appropriately filling in the arguments to one of the functions in theSummaryfunctions section. However, any groups in the report that the summary field refers to mustalready exist in the report.

For example, two variations of the Sum functions are:• Sum ({Orders.Order Amount})

Returns a total of all order amounts for the entire report.

• Sum ({Orders.Order Amount}, {Customer.Region})

207Creating Basic Formulas—Learner’s Guide

Page 224: BOC310 en Col91 FV Part Ltr Marca

Returns a total of the order amounts for each region.

Tip: A number of options exist for summarizing your data. Sum( ), Count ( ), and Average

( ) are themost common. Refer toSummary Functions in the onlineHelp formore information.

Count

This function enables you to count the values that appear in your report (for a specified field).

Some examples include these scenarios:• If a sales report includes all orders made and the amount of each order, you can compute

the total number of orders that appear on the report (a grand total count).• If you break orders into groups (for example, orders grouped by the region that they come

from), you can compute the number of orders per group (in this example, per region).• If you break orders into date or Boolean groups (for example, orders grouped by the month

in which they were placed), you can compute the number of orders per group based on aparticular change in the date or Boolean field (in this case, per month).

DistinctCount

This function enables you to get a distinct count of the values that appear in your report. Adistinct count means that duplicate records are not used in the calculation.

Some examples include:• If a sales report includes all orders made by customers, you can compute the total count of

distinct customers in the report (as grand total distinct count), excluding any duplicaterecords. If a customermademore than one order, the duplicate occurrences of that customerare ignored.

• If you break orders into groups (for example, orders grouped by the region that they comefrom), you can compute the count of distinct customers per group (in this case, per region).Any customers that made more than one order and appear more than once in a group areonly counted once.

• If you break orders into date or Boolean groups (for example, orders grouped by the monthin which they were placed), you can compute count of distinct customers in each groupbased on a particular change in the date or Boolean fields (in this case, the count of customersthat placed orders eachmonth). If a customer placedmore than one orderwithin themonth,duplicate instances of that customer are ignored.

Activity: Applying numeric calculations

Objective

• Create numeric calculation formulas.

Instructions

1. Use the Applying date calculations.rpt.

2. Group on the Customer Name, that is, {Customer.Customer Name}.

Fundamentals of Report Design—Learner’s Guide208

Page 225: BOC310 en Col91 FV Part Ltr Marca

3. Align the bottoms of the column names in the Page Header and then remove the customername field from theDetails section.

4. Add the formula,Order Plus Tax, which calculates the Order Amount plus a tax of 7% foreach Order.

5. Add the formula,GT Order Amount, which calculates the grand total Order Amount forall Orders.

6. Add the formula,GT Order Amount Plus Tax, which calculates the grand total OrderAmount for all Orders including tax for all Orders.

7. Add the formula, ST Order Amount, which calculates the subtotal Order Amount for eachCustomer.

8. Add the formula, STOrder Amount Plus Tax, which calculates the subtotal Order Amountincluding tax for each Customer.

9. Create labels for the subtotals and grand totals and format the labels to stand out on thereport.

10.Format all formulas to display with a dollar sign.

11.Save the report as Applying numeric calculations.rpt.

12.Add the report into the folder in theWorkbench.

Your report should look similar to this example.

209Creating Basic Formulas—Learner’s Guide

Page 226: BOC310 en Col91 FV Part Ltr Marca

Applying string manipulationString fields contain straight text, characters, numbers, or punctuation; string fields cannot beadded or subtracted from each other like numeric fields can.

After completing this unit, you will be able to:

• Describe a string manipulation formula• Create a string manipulation formula

String manipulation

Often, when creating a report, you want to embed the information from several string fieldstogether as one field. For example, a customer’s first and last name fields can be combined tobe one complete name field. In this way, formatting and moving this single field around thereport is easy.

By using formulas to manipulate the data contained in string fields you can get exactly whatyou need from your database.

Creating string manipulation formulas

String manipulation formulas include:• Subscript

• Concatenation

• Uppercase and Lowercase

• Left

• Mid

• Right

Subscript

When you want to use only a certain part of a string field, you can extract characters from thestring field using the subscript function.

For example, you may want to use only a first initial of a contact name instead of the entirename, or you may want to extract several characters from a string field. In the first example,you would create the formula:• {Customer.Contact First Name} [1]

Returns "A", where the Contact First Name is Anne-Marie.

When extracting several characters from a string field, you would create the formula:• {Customer.Contact First Name} [1 to 4]

Returns "Anne", where the Contact First Name is Anne-Marie.

Fundamentals of Report Design—Learner’s Guide210

Page 227: BOC310 en Col91 FV Part Ltr Marca

Concatenation

When youwant to join two ormore components together to form a singular continuous string,you would use one of the these concatenation symbols:• &

Enables you to join fields of different data types.

• +

Enables you to join string fields.

For example, if youwant to add descriptive text to your data field, youwouldwrite the formula:"This product was shipped on" & {Orders.Ship Date}

Uppercase(string) and Lowercase(string)

When you want to convert all letters in a string field to a specific case, you use the Uppercase( ) or Lowercase ( ) functions. For example, to convert all customer names to uppercase, youwould write the formula:Uppercase ({Customer.Customer Name})

This example would return EDWARD SMITH, where the customer name is Edward Smith.

Left (str, length)

The Left function consists of a text string (str) and length (length) and obtains a certainnumber of characters from the left end of a text string. For instance, you could use the Leftfunction to obtain just the area code from the values in a field containing phone numbers. Youwould write the formula:Left ({Customer.Phone}, 3)

This formulawould retrieve the first three numbers from the phone number, which is typicallythe area code.

Mid (str, start) or Mid (str, start, length)

The Mid function returns a specified number of characters from a string. The second argumentis the character position where the part to be taken begins. The optional third argument is thelength of the string you want to be taken out. If the third argument is not specified, everythingfrom the start position to the end of the string is extracted. Use this function when you needto extract a set of characters from somewhere in the middle of a text string. For example, youmay need to extract the middle two characters of a field as an identifier for customers.Mid({Customer.CustomerName}, 3, 2)

This formula returns a two-character substring from the inside of the string starting with thethird character position. In the case of Alley Cat Bikes, the identifier is “le”.

Right (str, length)

The Right function extracts the given number of text characters from the right side of thespecified string. Use this function to obtain just the right part of the string. For example, you

211Creating Basic Formulas—Learner’s Guide

Page 228: BOC310 en Col91 FV Part Ltr Marca

may need to obtain the last four digits of social security numbers stored in a field as an employeeidentifier.Right({table.SSNUM}, 4)

This formula returns the last four digits of the social security number as a string.

Activity: Applying string manipulation formulas

Objective

• Create string manipulation formulas.

Instructions

1. Use the Applying numeric calculations.rpt.

2. Add the formula, 1st Customer Letter, which extracts the first letter from the customer namefield.

3. Insert a group on the formula.

4. Rearrange the groups. This way, all groups of customers are grouped together beginningwith “A”, and so on.

5. Format the letter in a different color so it stands out.

6. Replace theGroup #2 Name field with a formula that displays the Customer Name inuppercase.

7. Create a formula namedDisplaySubtotal to display the following sentence:"The subtotal for " & {Customer.CustomerName} & " is " & {@ST Order Amount} & "."

8. Remove the Subtotal text object and @STOrderAmount, then replace with the@DisplaySubtotal.

9. Make sure the formula word wraps, if necessary.

10.Save the report as Applying string manipulation.rpt.

11.Add the report into the folder in theWorkbench.

Fundamentals of Report Design—Learner’s Guide212

Page 229: BOC310 en Col91 FV Part Ltr Marca

Your report should look similar to this example.

213Creating Basic Formulas—Learner’s Guide

Page 230: BOC310 en Col91 FV Part Ltr Marca

Debrief: Creating basic formulasReview the formulas created in this lesson.

SyntaxName

{Customer.Country}="USA"Check for USA

if {Customer.Country}="USA" then "Domestic" else"International"

Domestic or International

{Order.Ship Date} - {Orders.Order Date}Order Process Time

month({Orders.Order Date})Month Ordered

currentdate - {Orders.Ship Date}Days Since Shipped

{Orders.Order Amount} * 1.07Order Plus Tax

Sum({Orders.Order Amount})GT Order Amount

Sum({@Order Plus Tax})GT Order Amount Plus Tax

Sum({Orders.Order Amount}, {Customer.CustomerName})ST Order Amount

Sum({@Order Plus Tax}, {Customer.CustomerName})ST Order Amount Plus Tax

{Customer.CustomerName} [1]1st Customer Letter

UpperCase ({Customer.CustomerName})Uppercase Customer Name

"The subtotal for " & {Customer.CustomerName} & " is"& {@ST Order Amount} & "."

Display Subtotal

Fundamentals of Report Design—Learner’s Guide214

Page 231: BOC310 en Col91 FV Part Ltr Marca

Lesson 8Applying Conditional Reporting

Lesson introductionYou can easily apply absolute or conditional formatting, which is applied only under certainconditions.

After completing this lesson, you will be able to:

• Determine trends in data• Format data conditionally

215Applying Conditional Reporting—Learner’s Guide

Page 232: BOC310 en Col91 FV Part Ltr Marca

Determining trends in dataWhen you want to highlight certain information in a report in order to perform an analysis ofthe data, you can quickly establish trends in the data by using theHighlighting Expert.

After completing this unit, you will be able to:

• Use theHighlighting Expert

Using the Highlighting Expert

TheHighlighting Expert enables you to apply conditional formatting to all types of reportfields (Number, Currency, String, Boolean, Date, Time, and Date and Time fields). With theexpert, you format the selected field either by specifying a condition based on that field’s value,or by specifying a condition based on the value of a different report field.

When used for conditional formatting, theHighlighting Expert allows you to:• Modify several attributes at once, without writing a formula.• Highlight all field types used in the report.• Format font style, background color, font color, and border style.• Format a field based on its own values or the values of another field.

Conditionally formatting fields using the Highlighting Expert

When you need to conditionally format report fields, theHighlighting Expert is quicker andeasier to use than the Formula Workshop. TheHighlighting Expert is most commonly usedto highlight field values that are in some way distinguished from other values in the report.Youmight, for example, highlight your key customers by printing the {Customer.Last Year’s

Sales} field with a red background whenever the sales value exceeds $50,000. Alternatively,to draw attention to outstanding orders, you might bold the {Product.Product Name} fieldwhenever the {Orders.Shipped} value is False.

Tip: You can undo highlighting with the Undo button on the Standard toolbar to cancel theformatting.

Think of theHighlighting Expert as an advanced formula editor that runs the followingequation: If condition is True, then apply these formatting specifications. For this purpose, thedialog box is divided into two sections, the Item list section, which displays the formula, andthe Item editor, which enables you to set the formula. The Item editor includes a Sample viewto illustrate the formatting specifications applied.

Fundamentals of Report Design—Learner’s Guide216

Page 233: BOC310 en Col91 FV Part Ltr Marca

You can create formulas with this dialog box. Each formula appears in the Item list. You canuse the Remove and Remove All buttons to delete formulas as well as use the Priority arrowbuttons to specify the order of priority for each formula.

Tip: The changes in the formatting are seen in the Previewwindow only.

Setting highlighting priorities

The Priority buttons in the Item list area of theHighlighting Expert allow you to set prioritiesfor your formulas. This is usefulwhen youhave two ormore formulas that could offer conflictingresults in some situations.

For example, suppose that you highlight the Unit Price field on the report. You assign to thisfield a highlighting formula that shows a yellow background when a unit price is greater than$100. Then, on this same report, you create another highlighting formula that shows a redbackgroundwhen a unit price is greater than $200. Considering that 100 is a subset of 200, youcould have Unit Price fields with yellow backgrounds when, in fact, those fields should havered backgrounds. In other words, a unit price of $300 could receive either a red or a yellowbackground, depending on which formula has been assigned priority.

To use the Highlighting Expert

1. Right-click the field you want to format and selectHighlighting Expert from the shortcutmenu.

You can also start the expert by clicking theHighlighting button on theExpert Tools toolbar,or by clickingHighlighting Expert on the Formatmenu.

When opened, the expert is set to format the field that is currently selected on the report.

217Applying Conditional Reporting—Learner’s Guide

Page 234: BOC310 en Col91 FV Part Ltr Marca

2. In theHighlighting Expert, clickNew to create a new conditional formula with defaultsettings.

3. In the Item editor area, click the Value of list drop-down arrow and select the field thatyou want to base your condition on.

The field chosen here is the field upon which your condition is based; this field need not bethe field that is being formatted. To create a condition based on the values of the field thatis being formatted, select the desired field from the list. To base your condition on a differentreport field, select it from the list of available fields. The Value of list displays only thosefields that you have added to the report.

4. Select a comparison from the second list (is equal to, is less than, and so on).

This comparative statement works as the operator in the conditional formula created by theexpert.

5. Complete the condition by entering the desired value in the box.

Note: If the field selected in the Value of list is not numeric, the text box turns into a listof available values, from which you must select one.

6. In the Font style, Font color, Background, and Border lists, specify the formatting changesthat you want to apply to the selected field when your condition is met.

7. Repeat steps 3 and 4 if you want to apply multiple highlighting conditions to the selectedfield.

Note: You can use the expert’s Remove button to delete highlighting formulas from thelist.

Fundamentals of Report Design—Learner’s Guide218

Page 235: BOC310 en Col91 FV Part Ltr Marca

8. Use the Priority arrows to specify the order in which you want Crystal Reports to applyyour conditions.

Note: A formula has priority over another formula when it is higher in the Items list area.

9. ClickOK to return to your report.

Activity: Using the Highlighting Expert

Objective

• Use theHighlighting Expert to determine trends in data.

Instructions

1. Use the Conditional Reporting-1.rpt starting point report.

2. Add highlighting that displays the order amount in red if the order amount is $100.00 orless and blue if it is greater than or equal to $5,000.00.

3. Add purple highlighting for the order amount that is greater than or equal to $10,000.00.

Note: There should be three colorswhen done; however, youwon't see all three colors untilyou change the priority of the highlighting. Move to the second page to view the results forall three colors.

4. Save the report as Using the Highlighting Expert.rpt.

5. Add the report into the folder in theWorkbench.

219Applying Conditional Reporting—Learner’s Guide

Page 236: BOC310 en Col91 FV Part Ltr Marca

Your report should look similar to this example.

Fundamentals of Report Design—Learner’s Guide220

Page 237: BOC310 en Col91 FV Part Ltr Marca

Formatting data conditionallyConditional formatting is formatting that applies only under certain conditions that you set.

After completing this unit, you will be able to:

• Describe conditional formatting• Apply on or off properties• Apply attribute properties• Apply conditional formatting functions

Conditional formatting

Absolute formatting is formatting that applies under any condition and is usedwhen youwantthe same result in all situations.When you need to format objects only in certain cases or applythe formatting differently for different situations, you use conditional formatting.

With absolute formatting, you follow a “select then apply” procedure. You select the field andapply the formatting. For conditional formatting you follow the same general procedure, butyou go a step further and set conditions that determine whether or not the formatting will beapplied. You specify those conditions using simple formulas. You can apply formatting basedon a condition any time the conditional button appears beside an option. For example,conditional formatting can be used to display negative amounts in red or to suppress a fieldonly in a certain situation.

Conditional formatting takes precedence over fixed settings. For example, youmayhave appliedabsolute formatting to the font color of the sales field to appear in blue. If you then conditionallychange the color of the sales field to red if negative and black in all other cases, this changeoverrides the original setting. The sales fieldwill appear in red or black in the Previewwindowonly.

Tip: Each time you see the formula button next to a property or attribute, that property or attributecan be conditionally formatted.

A conditional property tests to see which of two or more conditions was met and applies theformatting appropriate to the condition. How you conditionally format an attribute differsbetween on or off properties and attribute properties.

Applying on or off properties

Anon or off property uses a check box.When the check box is turned on, the property is alwaysapplied. When the check box is turned off, the property is never applied. TheDrop Shadowproperty for a Border is an example of an on or off property. When you conditionally applyan on or off property, the program applies the attribute when the condition is met and doesnot apply the attribute when the condition is not met. Therefore, to set an on or off property,youmust create a Boolean formula that returns yes for every value to which youwant to applythe attribute. Whenever the result of the formula is no, the attribute is set to off.

221Applying Conditional Reporting—Learner’s Guide

Page 238: BOC310 en Col91 FV Part Ltr Marca

To apply on or off properties

1. In the report, right-click the field you want to format.

2. On the shortcut menu, click Format Field.

The Format Editor dialog box opens.

3. Click the appropriate tab.

4. Click the conditional formatting button beside the option you want to change.

5. Type a formula as the condition.

6. Click Save and Close.

The condition button changes color from blue to maroon, indicating a condition has beenset.

7. ClickOK.

Applying attribute properties

A conditional attribute property tests to see which of two or more conditions is met. Theprogram then applies the formatting appropriate to the condition. For example, assume thatyouwant values under quota printed in red and all other values printed in black. The programtests to see whether the value is under quota or not. If it is under quota, then it applies the redattribute; if it is not, then it applies the black attribute.

Use an If-Then-Else formula for this kind of conditional formatting.

When conditional attribute properties are set up, Crystal Reports loads a selection of attributesinto the Functions list in the Formula Workshop. Double-click any of these attributes to addthem to a formula. For example, if you are setting horizontal alignment conditionally, theFunctions list contains attributes such asDefaultHorAligned, LeftAligned, and Justified. Ifyou are setting borders conditionally, the Functions list contains attributes such asNoLine,SingleLine, andDashedLine.

Note: Always include the Else keyword in conditional formulas; otherwise, values that don’t meetthe If condition may not retain their original format. To retain the original format of values thatdon’t meet your If condition, use theDefaultAttribute function.

The program tests each record to see which of two or more conditions was met and applies theformatting appropriate to the condition. All attribute property options are listed within theFormat Formula Editor for your use.

The ability to conditionally format fields and objects gives youmore control over the presentationof your data in the report.

Fundamentals of Report Design—Learner’s Guide222

Page 239: BOC310 en Col91 FV Part Ltr Marca

Applying conditional formatting functions

Conditional formatting functions are found at the top of the Functions tree in the FormulaWorkshopwhenever appropriate. You can createmore complex conditional formatting formulasin the Formula Workshop using these built-in procedures or subroutines.

Two useful examples of conditional formatting functions are:• CurrentFieldValue

This function is available only when entering field formatting formulas. The field can beany type (string, number, Boolean, date, and so on). CurrentFieldValue returns the currentvalue of the field about to be printed and is especially useful when conditionally formattingcross-tabs. For example, the formula if CurrentFieldValue = 0 then Red can be used toformat the font color in a cross-tab. This function depends on context (that is, if formattinga string field, then CurrentFieldValue is a string type; if formatting a date field, thenCurrentFieldValue is a date type, and so on).

• DefaultAttribute

This function is available when entering formatting formulas including section formattingformulas, text object formatting formulas, and so on. The value returned by DefaultAttributedepends on the value selected for the attribute being formatted. For example, if you createa formatting formula for the font color, and the font color combination box is set to blue,then DefaultAttribute is blue. If you create a formatting formula for a Boolean attributesuch asSuppress, and ifSuppress is checked, then the DefaultAttribute is true. IfSuppressis not checked, then the DefaultAttribute is false. This function depends on context (thatis, it may be a Boolean type, a string type, and so on).

To apply an attribute property

1. In the report, right-click the field to format and select Format Field from the shortcutmenu.

2. Click the appropriate tab and add a formula by clicking the conditional formatting buttonnext to the option you want to change.

Note: You can also use summary values as conditions. For example, you could change thefont color to red if the value is less than the average for the group: if {Customer.Last Year’s Sales} < Average({Customer.Last Year’s Sales}, {Customer.Region}) then Red Else DefaultAttribute

3. ClickOK to return to the report.

Activity: Formatting data conditionally

Objective

• Apply conditional formatting to a report.

223Applying Conditional Reporting—Learner’s Guide

Page 240: BOC310 en Col91 FV Part Ltr Marca

Instructions

1. Use the previous activity report called Using the Highlighting Expert.rpt.

2. Suppress the duplicated customer names.

3. Use conditional formatting (not theHighlighting Expert) to add formatting that displaysthe customer name with a red background and white lettering if the order amounts are$100.00 or less.

4. Use conditional formatting (not theHighlighting Expert) to add formatting that displaysthe customer name with a drop shadow if the order amounts are greater than $5000.00.

5. Save the report as Formatting data conditionally.rpt.

6. Add the report into the folder in theWorkbench.Your report should look similar to this example.

Fundamentals of Report Design—Learner’s Guide224

Page 241: BOC310 en Col91 FV Part Ltr Marca

Quiz: Applying conditional reporting1. When you need to format objects only in certain cases or apply formatting differently for

different situations, you use .

2. What type of formula do you need to create when you set an on or off property?

3. What type of formula do you need to create when you apply an attribute property?

4. When would you use a conditional formatting function?

225Applying Conditional Reporting—Learner’s Guide

Page 242: BOC310 en Col91 FV Part Ltr Marca

Lesson summaryAfter completing this lesson, you are now able to:

• Determine trends in data• Format data conditionally

Fundamentals of Report Design—Learner’s Guide226

Page 243: BOC310 en Col91 FV Part Ltr Marca

Lesson 9Representing Data Visually

Lesson introductionYou can include sophisticated, colorful charts in your reports. These charts can enhance theinformation in your reports, making them more comprehensible.

After completing this lesson, you will be able to:

• Create a chart

227Representing Data Visually—Learner’s Guide

Page 244: BOC310 en Col91 FV Part Ltr Marca

Creating a chartMany people find it easier to understand information if it is presented graphically.

After completing this unit, you will be able to:

• Choose a chart location and type• Create a chart using the Chart Expert• Chart on summary data• Chart on details or formula information• Customize a chart

Choosing a chart location and type

Crystal Reports enables you to include sophisticated, colorful charts in your reports. You canuse charts any time to improve the usefulness of a report.

You can chart on:• Summary and subtotal fields• Details, formula, and Running Total fields• Cross-Tab summaries• OLAP data

You will typically chart on summary and subtotal information at the group level. Each chartbecomes an object on your report, and therefore can be moved, resized, and so on.

Not all chart styles work with all data. For example, a report that shows the total sales for eachstate would make a good pie chart but a meaningless stacked bar chart, since only one seriesof data exists. On the other hand, if you had a report that showed inventory levels of certainitems for each quarter of the year, that information wouldmake an excellent stacked bar chart,but not work in a single pie chart.

Where you place your chart determines what data is displayed and where it is printed. Forexample, if you place a chart in the Report Header section, the chart includes data for the entirereport. If you place it in a Group Header or Group Footer section, the chart displaysgroup-specific data.

Inserting a chart using the Chart Expert

The Chart Expert dialog box allows you to choose the type of chart to display, select the dataon which the chart is based, apply conditional color highlighting, as well as customize theoptions and formatting for the chart.

Using the Chart Expert

The Chart Expert is a tabbed dialog box. As you work through each tab, be aware that someoptions are not for use with some types of chart.

The tabs in the Chart Expert are:

Fundamentals of Report Design—Learner’s Guide228

Page 245: BOC310 en Col91 FV Part Ltr Marca

• Type• Data• Axes• Options• Color Highlight• Text

To insert a chart using the Chart Expert

1. On the Insertmenu, click Chart.Another way to do this is to click the Insert Chart button on the Insert Tools toolbar.

An insertion frame appears.

2. Position the top-left corner of the frame in the target location for the new chart. Click onceto insert the chart.Depending onwhere you place the chart, theChart Expert opens automatically or youmayneed to right-click the chart once it is placed and select the Chart Expert from the shortcutmenu.

You can customize the chart according to your needs.

3. ClickOK after you have finished customizing the chart.

Exploring the Type tab

The first tab in the Chart Expert offers different predefined chart styles to choose from. Toselect a particular style, double-click the icon for the desired report.

229Representing Data Visually—Learner’s Guide

Page 246: BOC310 en Col91 FV Part Ltr Marca

The most common chart types are:• Bar

A side-by-side bar chart displays a series of vertical bars and is best suited for showing datafor several years over a period of time. A stacked bar chart also displays data as a series ofvertical bars and is best suited for representing three series of datawith each series displayedas a different color stacked in a single bar.

• Pie

A pie chart displays data as a pie, split and filled with color or patterns, and can only beused with one group of data.

Other chart types include:• Line

A line chart displays data as a series of points connected by a line and is best suited forshowing data for a large number of groups.

• Area

An area chart displays data as areas filled with color or patterns and is best suited forshowing data for a limited number of groups.

• Doughnut

Adoughnut chart is similar to a pie chart, displaying data as sections of a circle or doughnut.If, for example, you charted sales by region on a particular report, you would see the totalnumber of sales (the figure) in the center of the doughnut and the regions as colored sections

Fundamentals of Report Design—Learner’s Guide230

Page 247: BOC310 en Col91 FV Part Ltr Marca

of the doughnut. As with the pie chart, you have the option to choose multiple doughnutcharts for multiple groups of data.

• 3D Riser

A 3D riser chart displays data in a series of three-dimensional objects, lined up side by sidein a three-dimensional plane. The 3D riser chart shows the extremes in your report data.For example, the difference in sales between countries is visually dynamic when presentedin this chart.

• 3D Surface

A 3D surface chart presents a topographic view of multiple sets of data. If, for example, youneed a chart to show the number of sales by customer by country in a visually dynamic andrelational format, you would use a 3D surface chart.

• XY Scatter

An XY scatter chart is a collective of plotted points that represent specific data in a pool ofinformation. The XY scatter chart enables you to consider a larger scope of data for thepurpose of determining trends. For example, if you input customer information, includingsales, products, countries, months, and years, you would have a collective of plotted pointsthat represents the pool of customer information. Viewing all of this data on an XY scatterchart would enable you to speculate why certain products were selling better than othersor why certain regions were purchasing more than others.

• Radar

A radar chart positions group data, such as customers or countries, at the perimeter of theradar. The radar chart then places numeric values, increasing in value, from the center ofthe radar to the perimeter. In this way, you can determine, at a glance, how specific groupdata relates to the whole of the group data.

• Bubble

A bubble chart displays data as a series of bubbles, where the size of the bubble isproportional to the amount of data. A bubble chart is effective with the number of productssold in a certain region; the larger the bubble, the greater number of products sold in thatregion.

• Stock

A stock chart presents high and low values for data. With this ability, the stock chart isuseful for monitoring financial or sales activities.

• Numeric Axis

A numeric axis chart is a bar, line, or area chart that uses a numeric field or a date/timefield as its “On change of” field (instead of a string field). Numeric axis charts provide away of scaling your X-axis values, thus creating a true numeric X-axis or a true date/timeX-axis.

• Gauge

Agauge chart presents values graphically as points on a gauge. Gauge charts, like pie charts,are typically used for one group of data (for example, the percentage of sales for the entireinventory).

231Representing Data Visually—Learner’s Guide

Page 248: BOC310 en Col91 FV Part Ltr Marca

• Gantt

A Gantt chart is a horizontal bar chart often used to provide a graphical illustration of aschedule. The horizontal axis shows a time span, while the vertical axis shows a series oftasks or events. Horizontal bars on the chart represent event sequences and time spans foreach item on the vertical axis.

• Funnel

Funnel charts are often used to represent stages in a sales process, for example, the amountof potential revenue shown for each stage. This type of chart can also be useful in identifyingpotential problem areas in an organization’s sales processes. A funnel chart is similar to astacked bar in that it represents 100% of the summary values for the groups included in thechart.

• Histogram

A histogram chart shows the frequency of occurrence of data elements in a data set. The Xaxis is divided into intervals that denote ranges of data values. Each histogram bar showsthe number of data elements whose value falls into that interval.

Tip: Not all data ranges work with all chart styles. A summary report showing the total sales foreach region would make a good pie chart. The same report showing the same regions over severalyears would make a good multiple pie chart.

Exploring the Data tab

In theData tab, you select the chart layout type you want to use.

Fundamentals of Report Design—Learner’s Guide232

Page 249: BOC310 en Col91 FV Part Ltr Marca

The charting layout types are:• Advanced

Use the Advanced layout when you have multiple chart values or when you do not haveany group or summary fields in the report.

TheAdvanced chart layout supports one or two condition fields; with these condition fields,you can create a 2D or 3D chart. Other specific functions with theAdvanced layout include:○ Values can be grouped in ascending, descending, or specified order, as well as by Top

N or Sort totals.○ Values can be plotted for each record.○ Values can be plotted as a grand total for all records.○ Charts can be based on formula and Running Total fields.

Note: You cannot drill down on an advanced chart because the chart is already displayingall the data for that field.

• Group

With this option, you can create charts based on any group summary or subtotal values.

Note: In order to create a chart using theGroup layout, you must have at least one groupand at least one summary field in the report.

• Cross-Tab

TheCross-Tab option is available when a report contains a cross-tab object and enables youto present the data in the cross-tab graphically. A Cross-Tab chart uses the fields in thecross-tab for its condition and summary fields.

• OLAP

On-Line Analytical Processing (OLAP) is a business intelligence tool with the ability toperform “slice and dice” operations for multi-dimensional viewing and manipulation ofdata. Use theOLAP layout to chart on an OLAP grid.

Note: In this training guide, you will learn how to create an advanced chart and a group chart.

Once you have selected your chart type, the appropriate choices are presented within theDatatab. If you have running totals in your report, you can select running totals fields to displaythem in the chart. Also, if you want to chart on all records so that the grand totals display, thenselect For all records from the drop-down list on the right side of the dialog box and specify achart placement of Once per report. You also select the placement and data in theData tab.

Exploring the Axes tab

In the Axes tab, you can specify properties that control the occurrence and frequency of datathat divides axes on your chart.

233Representing Data Visually—Learner’s Guide

Page 250: BOC310 en Col91 FV Part Ltr Marca

By default, the data axis is not scaled automatically and always starts at zero. If you turn theAuto scale check box on, the data axis scales automatically. However, depending on the data,the data axis may not start at zero.

Exploring the Options tab

On theOptions tab, you can set the color of the chart, data points, customize settings, andchoose whether or not to include a legend. If you do include a legend in a pie or doughnutchart, you can choose to display the data in percentages or in amounts.

Fundamentals of Report Design—Learner’s Guide234

Page 251: BOC310 en Col91 FV Part Ltr Marca

Exploring the Color Highlight tab

The Color Highlight tab lets you conditionally apply color based on chart value fields. Youapply a color to the selected item by specifying a condition.

The tab is divided into two areas: The Item list area displays the formula conditions and theItem editor area is where you create the formula conditions.

Note: If your chart type is line, the chart must have data markers before you can see conditionalformatting. An area chart must have two On change of values for conditional formatting to appear.

235Representing Data Visually—Learner’s Guide

Page 252: BOC310 en Col91 FV Part Ltr Marca

Exploring the Text tab

The Text tab lets you specify different titles to be placed on your report explaining the variouscomponents. This tab always presents all options, even though some charts may not use them.For example, a pie chart would not have a group title or data title as available text options.

Fundamentals of Report Design—Learner’s Guide236

Page 253: BOC310 en Col91 FV Part Ltr Marca

If you accidentally exit the Chart Expert, you can return at any time by right-clicking the chartin your report and selecting Chart Expert from the shortcut menu.

The chart you see in theDesignwindow is a placeholder that prints the actual chart informationwhen you switch to the Previewwindow. Therefore, the chart in theDesignwindow willprobably be different fromwhat youwere expecting based on your data. You can always returnto the Chart Expert to redesign your chart.

If you place the cursor over the chartwhile in thePreview tab, a tooltipwith detailed informationappears. For example, a chart that shows sales for different countries would read “USA: Sumof Customer.1997 Sales: 3410088.85.”

No matter what type of chart you choose, the basic steps to produce a chart are the same.

Charting on summary data

Charting summary and subtotal information (Group layout) is themost common type of chart.Before you can create a chart, you must have at least one group and one summary or subtotalin your report. A chart built on summary data offers the benefit of drill-down capability, theability to access multiple summaries with the double-click of a mouse button.

To create a summary chart

1. On the Insertmenu, click Chart.

The Chart Expert appears.

237Representing Data Visually—Learner’s Guide

Page 254: BOC310 en Col91 FV Part Ltr Marca

Tip: Another way to do this is to click the Insert Chart button on the Insert Tools toolbar.

An insertion frame appears.

2. Position the top-left corner of the frame in the target location for the new chart. Click onceto insert the chart.Depending onwhere you place the chart, theChart Expert opens automatically or youmayneed to right-click the chart once it is placed and select the Chart Expert from the shortcutmenu.

3. On the Type tab, in the Chart type list, select a chart type and then click the chart subtypethat best illustrates your data.

4. Click theData tab.

5. In the Layout area, clickGroup, if it is not already selected.

6. In theData area, in theOn change of list, click the group field you want to base your charton; then, in the Show list, click the summary field you want to display on your chart.

7. If theAxes andOptions tabs appear, you can customize some of the chart’s properties, suchas the scaling of the axes, the legend, and the data points.

8. Click the Text tab.

9. Accept the default title information or add new titles to your chart.

10.ClickOK.Your chart is placed in theHeader or Footer section of the report, depending on your selectionin Step 6. You may have to refresh your report to preview the finished chart.

When your chart is inserted, it may cover a portion of the report. Move and resize the chartso that it fits properly within the report.

Drilling down on a chart

Drill-down is a process where the details behind summary information can be revealed byclicking the summary information contained in a report.

A chart that is based upon summary fields is a candidate for drill-down. For each level ofgrouping and summarizing that make up the chart, you can drill down into the data to see theunderlying information that constitutes those totals.

If a chart consists of one or more group fields and you have included a legend, you can drilldown on individual groups through the chart legend. Double-click the cursor on the markersand text in the legend to view the details about that section of the chart.

For example, on a report showing total sales for each region with a pie chart based on thosesubtotals, double-clicking a pie slice opens a drill-down tab showing the individual entries thatmake up that subtotal.

When viewing a chart in the Previewwindow, the cursor changes to amagnifying glass.Whenyou double-clickwith thismagnifying glass, a newPreview tab opens up and the details behindthat summary are displayed.

Fundamentals of Report Design—Learner’s Guide238

Page 255: BOC310 en Col91 FV Part Ltr Marca

You can double-click as many summaries as you want as each one opens its own drill-downtab.

Note: You cannot drill down on an advanced chart because the chart is already displaying all thedata for that field.

To drill down on chart information

1. In the Previewwindow, scroll your report so you can see your chart.

2. Move the cursor over the body of the chart until the magnifying glass appears.

You should get a magnifying glass over each piece of a pie chart.

3. When you are positioned over the summary information on which you want to drill-down,double-click with the magnifying glass.A new drill-down tab is created for the information you clicked.

Tip: Closing the drill-down tabs does not close the report. However, closing the Previewtab closes all drill-down tabs. If you made any changes since the last save and you close thereport, you will be prompted to save those changes.

Activity: Charting on summary data

Objective

• Create a chart that is based on summarized data.

Instructions

1. Create a new report from the Customer and Orders table.

2. Place the Customer Name, Order ID, and Order Amount into the Details section.

3. Insert a group based on the order date and set the group options to be displayed by year.

4. Insert a summary on the order amount per the order date group.

5. Create a bar chart in the report header using the group layout to compare order amountper year.

6. Give your chart a title of “Order Amounts Per Year.”

7. Preview your report.

8. Drill down to view the 2004 information.

9. Save the report as Charting on summary data.rpt.

10.Add the report into the folder in theWorkbench.Your report should look similar to this example.

239Representing Data Visually—Learner’s Guide

Page 256: BOC310 en Col91 FV Part Ltr Marca

Charting on details or formula information

The Advanced layout enables you to create a chart based on specific values (details or formuladata). Charts are often based on a summary field in your report in which the values plotted inthe chart depend on the values in the summary field. However, you can also create a chart thatdoes not have a summary field to chart on. Instead, these types of charts use values that appearin the Details section of your report.

To create a details or formula chart, you need to specify:• Condition

The condition is used to indicate when to plot the point. Each time a point is plotted, it isplotted at the point representing the corresponding value. For example, a chart showinglast year’s sales for your customers uses the Customer Name field as the condition. Eachtime the condition changes (that is, the customer name changes), a point is plotted. You alsohave the option of plotting a point for each record, or plotting one point for all records.

• Value

The value is used to indicate what is plotted as the points on your chart. Each time a pointis plotted, it is plotted at the point representing the corresponding value.

To chart on details information

1. On the Insertmenu, click Chart.

Fundamentals of Report Design—Learner’s Guide240

Page 257: BOC310 en Col91 FV Part Ltr Marca

Tip: Another way to do this is to click the Insert Chart button on the Insert Tools toolbar.

An Insertion frame appears.

2. Position the top-left corner of the frame in the target location for the new chart. Click onceto insert the chart and open the Chart Expert dialog box, if the Chart Expert doesn’tautomatically open.

3. On the Type tab, in the Choose your chart type list, select a chart type.

4. Select the chart subtype that best illustrates your data.

5. SelectVertical or Horizontal depending on the Axes that most clearly illustrates your data.

Note: If you want to make any chart 3D, select Use depth effect.

6. Click theData tab.

7. In the Layout area, click Advanced, if it is not already selected.

8. In theData area, specify the database fields you want to use as conditions.

You can selectOn change of from the list, then add up to two database fields in the boxunderneath the list.

The arrow buttons on the Chart Expert dialog box allow you to move fields from one listto the other. Single arrows move only the selected field; double arrows move all fields atthe same time.

9. Add the database fields you want to use as values to the Show value(s) list.

241Representing Data Visually—Learner’s Guide

Page 258: BOC310 en Col91 FV Part Ltr Marca

10.If you do notwant Crystal Reports to automatically summarize the chart values for a formulafield, select theDon’t summarize check box.

11.If theAxes andOptions tabs appear, you can customize some of the chart’s properties, suchas the scaling of the axes, the legend, and the data points.

12.Click the Text tab.

13.Accept the default title information or add new titles to your chart.

14.ClickOK.Your chart is placed in the location of the insertion frame. You may have to refresh yourreport to preview the finished chart.

Note: When your chart is inserted, it may cover a portion of the report. Move and resizethe chart so that it fits properly within the report.

Activity: Charting on detail information

Objective

• Create a chart that is based on details data by using the Chart Expert.

Instructions

1. Open the Charting-1.rpt starting point report.

2. Create a pie chart with 3D visual effects using the Advanced Layout showing the customerstheir last year’s sales. Place the chart in the Report Header.

3. Ensure that the legend displays the percentage of the last year's sales.

4. Change the placement of the legend to the left of the chart.

5. Resize the chart to expand to the entire Report Header section.

6. Preview the report.

7. Save the report as Charting on detail information.rpt.

8. Add the report into the folder in theWorkbench.Your report should look similar to this example.

Fundamentals of Report Design—Learner’s Guide242

Page 259: BOC310 en Col91 FV Part Ltr Marca

Customizing a chart

Once you have created a chart, youmay want to add a new title, headings, or a legend, changefonts, or even change the type of chart. Crystal Reports provides many options for workingwith your existing charts.

When you customize a chart, you can:• Edit a chart using the Chart optionmenu items• Use the zooming features with bar and line charts• Auto-arrange a chart in the report

Editing charts in the Chart Options dialog box

TheChart Options dialog box contains many advanced formatting options. To open theChartOptions dialog box, right-click any chart and select Chart Options. Each tab in the ChartOptions dialog box varies according to the type of chart selected.

For example, when you open the Chart Options dialog box for a bar chart, the Appearancetab allows you to change the overlap, gap width, depth, and direction of the boxes. After rightclicking a pie chart and selecting Chart Options, theAppearance tab allows you to change thetilt, depth, rotation, and explode distance for the pie chart.

On every tab, the graphic on the left side of the dialog box gives an approximation of how youredits will affect the chart.

243Representing Data Visually—Learner’s Guide

Page 260: BOC310 en Col91 FV Part Ltr Marca

To edit a chart by using Chart Options

1. Right-click the chart and select Chart Options from the shortcut menu.

2. In the Chart Options dialog box, make the desired changes.

3. ClickOK.

Exploring the Appearance tab

In the Appearance tab, you vary the data elements that affect the appearance of the chart.

Depending on the chart type, the appearance tab offers different data elements. For example,you can change the degree of tilt of a pie chart, change the style of line in a line chart, or changethe gaps between the bars in a bar chart.

Exploring the Titles tab

In the Titles tab, you can add, remove, or modify the title of your chart.

Fundamentals of Report Design—Learner’s Guide244

Page 261: BOC310 en Col91 FV Part Ltr Marca

Here you can add or edit the chart’s title, subtitle, and footnote. For some chart types, the Titlestab also allows you to add and edit the group and data titles.

Exploring the Data Labels tab

On this tab, you can conceal or reveal values, labels, leader lines, and the name the data fieldsused to build the pie name.

You can also specify the location and format of the values and labels you’ve chosen to display.

245Representing Data Visually—Learner’s Guide

Page 262: BOC310 en Col91 FV Part Ltr Marca

Exploring the Legends tab

On this tab, you can conceal or reveal the legend.

You can alsomodify the layout, style, and specify colormode by group or series for the legend.This tab may not be available for all chart types.

Exploring the Gridlines tab

On this tab, you can conceal or reveal the gridlines.

Fundamentals of Report Design—Learner’s Guide246

Page 263: BOC310 en Col91 FV Part Ltr Marca

You can modify the gridlines for Group and Data axes. This tab may not be available for allchart types.

Exploring the Axes tab

On this tab, you can conceal or reveal the axis labels.

You can also toggle between time, ordinal, and numeric scales.

Using the zooming features with bar and line charts

On the Preview tab, you can find commands for zooming bar charts and line charts withinyour report. You have the ability to zoom in and out on these chart types at any time, with eachtime being referred to as instance specific. If you decide to save the instance of the chart thathas been zoomed in or out, you must save the data with the report.

To zoom in and out on a bar or line chart

1. On the Preview tab, right-click the bar or line chart to bring up the shortcut menu.

2. On the shortcut menu, click Zoom In.

3. Drag the Zoom In cursor around a section of the chart to enclose it within the trackingrectangle.The chart zooms in to the section you selected.

4. Repeat the previous step to zoom in further.

247Representing Data Visually—Learner’s Guide

Page 264: BOC310 en Col91 FV Part Ltr Marca

Note: To see adjacent areas on a zoomed-in chart view (neighboring bars in a bar chart, forexample), use the Pan option on the shortcut menu. Pull the Pan cursor to the left or rightto move in that direction.

5. To zoom out on a chart, right-click the chart to bring up the shortcut menu.

6. On the shortcut menu, click Zoom Out, and then click the chart.The chart zooms out one level of magnification.

7. Click the chart again to zoom out further.

Auto-arranging a chart

If you move or resize chart objects on the Preview tab, select the auto-arrange chart feature toreset the chart.

To auto-arrange a chart

1. On the Preview tab, right-click the chart to bring up the shortcut menu.

2. On the shortcut menu, click Auto-Arrange Chart.Crystal Reports resets the chart to its original size and position.

Activity: Customizing a chart

Objective

• Modify an existing chart in a report by using the Chart Options dialog box.

Instructions

1. Open the Charting on detail information.rpt from the previous activity.

2. Remove the border from the legend.

3. Expand the pie depth to 75.

4. Show the last year sales values around the pie chart.

5. Display the values as a percentage outside of the slices.

6. Make the pie slices appear to have separated from each other by 20%.

Tip: Use the Explode feature.

7. Save the report as Customizing a chart.rpt.

8. Add the report into the folder in theWorkbench.

Fundamentals of Report Design—Learner’s Guide248

Page 265: BOC310 en Col91 FV Part Ltr Marca

Your report should look similar to this example.

249Representing Data Visually—Learner’s Guide

Page 266: BOC310 en Col91 FV Part Ltr Marca

Quiz: Representing data visually1. What functionality would you use when you have multiple chart values or when you do

not have any group or summary fields in the report?

2. What functionality would you use when you want to set the appearance, titles, data labels,or legend of the chart?

3. What functionality would you use when you want to set conditional color formatting?

4. What functionality would you use when you need to see the details behind summaryinformation in a bar chart?

5. What functionality would you use when you want to create a chart based on detailinformation?

Fundamentals of Report Design—Learner’s Guide250

Page 267: BOC310 en Col91 FV Part Ltr Marca

Lesson summaryAfter completing this lesson, you are now able to:

• Create a chart

251Representing Data Visually—Learner’s Guide

Page 268: BOC310 en Col91 FV Part Ltr Marca

Fundamentals of Report Design—Learner’s Guide252

Page 269: BOC310 en Col91 FV Part Ltr Marca

Lesson 10Distributing a Report

Lesson introductionNow that you have a finished report, you may need to share it with other people. One of themost common forms of distributing a report is by exporting it to a different format other thana Crystal Reports file. You can also save the report to BusinessObjects Enterprise, theweb-basedreport management system from Business Objects.

After completing this lesson, you will be able to:

• Export a report• Save a report to BusinessObjects Enterprise

253Distributing a Report—Learner’s Guide

Page 270: BOC310 en Col91 FV Part Ltr Marca

Exporting a reportFinished reports can be exported to a number of popular spreadsheet and word processorformats, as well as to HTML, ODBC, and common data interchange formats. This makes thedistribution of information easier. For example, youmay want to use the report data to projecttrends in a spreadsheet package or to enhance the presentation of data in a desktop publishingpackage.

After completing this unit, you will be able to:

• Define exporting• Define exporting formats• Define exporting destinations• Export a report

Exporting reports

Crystal Reports lets you insert objects anywhere on the report page. However, when you exportto formats such as MS Word, MS Excel, and HTML, objects that you placed between lines aremoved to the closest line in the output. To alleviate the formatting problems this behavior couldcause, it is recommended that you use guidelines when designing your reports.

The exporting process requires you to specify a format and a destination. The format determinesthe file type, and the destination determines where the file is located.

Exporting formats

Crystal Reports provides you with many different export format types:• Crystal Reports (RPT)• HTML 3.2• HTML 4.0• Microsoft Excel (97–2003)• Microsoft Excel (97–2003) Data-only• Microsoft Word (97–2003)• Microsoft Word (97–2003) - Editable• ODBC• PDF• Record style - Columns with spaces• Record style - Columns without spaces• Rich Text Format (RTF)• Separated Values (CSV)• Tab-separated text (TTX)• Text• XML

Fundamentals of Report Design—Learner’s Guide254

Page 271: BOC310 en Col91 FV Part Ltr Marca

In addition to the standard export format types installed on your machine you may findadditional export format types are available to you. These format types are determined by theDLL files on your local machine.

When you export a report to a file format other than Crystal Reports format (RPT), you maylose some or all of the formatting that appears in your report. However, the program attemptsto preserve as much formatting as the export format allows.

Note: The XML exporting functionality supports the use of transforms. You can export to XMLand then use an industry-specific transform to present the data in an industry-specific format. Forexample, you would use the JRDC transform if you worked in the justice/law enforcement area.

Exporting destinations

The destination determines the export location of your report. Crystal Reports enables you tochoose one of six destinations. They include:• Application• Disk file• Exchange folder• Lotus Domino• Lotus Domino Mail• MAPI (Microsoft Mail)

To export a report

1. With your report open, and saved if you have made changes, select the Export button fromthe Standard toolbar.

The Export dialog box opens.

2. Select a format type from the Format drop-down list.

3. Select a destination type from theDestination drop-down list.

4. ClickOK.

5. Enter any additional information that you are prompted for.

255Distributing a Report—Learner’s Guide

Page 272: BOC310 en Col91 FV Part Ltr Marca

For example, if you selected mail as the destination, you will be prompted to enter thedestination names, subject, and message.

Exporting a report to application formats

The export formats supported by Crystal Reports can be broadly categorized in two groups:Page-based formats and record-based formats.

Page-based formats tend to produce a more exact output. The emphasis of these formats islayout representation and formatting. Formatting refers to attributes such as font style, textcolor, text alignment, background color, and so on. Layout refers to object position, object size,and the relationship between these attributes and other objects. Depending on the format youchoose, it may not be possible for the program to preserve all layout and formatting perfectly,but page-based formats, in general, preserve these properties as closely as possible.

With record-based formats, the emphasis is on data rather than the layout and formatting.However, in some formats—such as Microsoft Excel - Data only—you will notice that someformatting is exported. Some of the record-based formats are only data-exchange formats.

Exporting a report to Microsoft Excel

Microsoft Excel format is a page-based format. This format converts your report contents intoExcel cells on a page-by-page basis. Contents from multiple pages are exported to the sameExcel worksheet. If a worksheet becomes full and there is more data to export, the exportprogram creates multiple worksheets to accommodate the data. If a report object covers morethan one cell, the export programmerges cells to represent a report object. Microsoft Excel hasa limit of 256 columns in a worksheet; therefore, any report object (or part of it) that is addedto cells beyond 256 columns is not exported. This export format retains most of the formatting,but it does not export line and box objects from your report.

Microsoft Excel - Data only, as the name suggests, is a record-based format that concentrateson data. Even so, this format does export most of the formatting, too. Unlike Microsoft Excelformat, Microsoft Excel - Data only format does not merge cells—each object is added to onlyone cell. This format can also export certain kinds of summaries in Crystal Reports as Excelfunctions. The summaries that are supported are SUM, AVERAGE, COUNT, MIN and MAX.

Exporting a report to Microsoft Word

Microsoft Word (RTF) is a page-based, exact format that produces an RTF (Rich Text Format)file. The exported file contains text and drawing objects to represent report objects. Individualobjects are placed in text frames. This format is intended for use in applications such as fill-outforms where the space for entering text is reserved as empty text objects. Almost all of theformatting is retained in this export format. Text objects cannot, however, be placed outsidethe left edge of the page. Therefore, if you have text objects in your report that are placed beforethe left edge of the printable area, they will be pushed right. (This is most noticeable in reportswith wide pages.)

Fundamentals of Report Design—Learner’s Guide256

Page 273: BOC310 en Col91 FV Part Ltr Marca

The Microsoft Word - Editable (RTF) format is different fromMicrosoft Word (RTF) format; itis a page-based format, but not all of the layout and formatting are preserved in the output.This format converts all of the report object contents to text lines. UnlikeMicrosoftWord (RTF)format, this format does not use text frames. Text formatting is retained, but attributes such asbackground color, fill pattern, and so on may not be retained. All images in your report areinlined with the textual content and, therefore, the images automatically shift to accommodatetext when the document is edited in Microsoft Word. This format does not export line and boxobjects from your report.

The Microsoft Word - Editable (RTF) format has an option to insert page breaks at the end ofeach report page. This option may not correspond to the page breaks created by MicrosoftWord; the option is used mainly to separate your report-page contents.

Saving an export option

You can save an export option for a report that will be exported to various formats. Theseexport options are then saved in the report and used as the default export optionswhen viewingor scheduling a report in BusinessObjects Enterprise.

To save report export options

1. Click File ➤ Export ➤ Report Export Options.The Set Default Export Options dialog box appears.

2. Select the export format.

257Distributing a Report—Learner’s Guide

Page 274: BOC310 en Col91 FV Part Ltr Marca

3. ClickOK.

Activity: Exporting a report to Microsoft Excel

Objective

• Export a report to Excel and Excel (Data Only) to compare the differences between the twoexporting destinations.

Instructions

1. Open Exporting a Report-1.rpt starting point report.

2. Export the report to Microsoft Excel (97-2003) with certain criteria:• Make sure there are page breaks for each page.• Convert the order date to be displayed as a string.• Make sure that each page header is displayed on each page.

3. Save the output as Exporting to Excel.xls.

4. Open Exporting to Excel.xls to view it.

Fundamentals of Report Design—Learner’s Guide258

Page 275: BOC310 en Col91 FV Part Ltr Marca

Your report in Excel should look similar to this example.

5. Export Exporting a Report-1.rpt toMicrosoft Excel (97-2003) Data-only. Ensure that theXtreme logo is also exported.

6. Save the output as Exporting to Excel Data only.xls and view the results.

259Distributing a Report—Learner’s Guide

Page 276: BOC310 en Col91 FV Part Ltr Marca

Your report inMicrosoft Excel (97-2003) Data-only should look similar to this examplewhenyou first view it in the application.

7. Fix the formatting in the report:• Expand the columns so all the numbers are visible.• Add another row and copy the report title into it. Bold the report title to make it stand

out.• Expand the row with the Xtreme logo to make it visible.

Fundamentals of Report Design—Learner’s Guide260

Page 277: BOC310 en Col91 FV Part Ltr Marca

Your report in Microsoft Excel (97-2003) Data-only should now look like this example.

8. Compare the differences between the two export formats:• The Microsoft Excel (Data only) version needed post-processing work in order to make

it readable.

Activity: Exporting a report to Microsoft Word

Objective

• Export a report to RTF and Microsoft Word (97-2003) - Editable to compare the differencesbetween the two exporting formats.

Instructions

1. Open the Exporting a Report-1.rpt starting point report.

2. Export the report to RTF and save the output as Exporting to RTF.

3. View the RTF document.

261Distributing a Report—Learner’s Guide

Page 278: BOC310 en Col91 FV Part Ltr Marca

Your exported report should look similar to this example.

4. Open the Exporting a Report-1.rpt starting point report.

5. Export the report toMicrosoftWord - Editable and save it as Exporting to Word - Editable.

6. Insert page breaks after each report page.

7. Save the output and view the Microsoft Word document.

Fundamentals of Report Design—Learner’s Guide262

Page 279: BOC310 en Col91 FV Part Ltr Marca

Your exported report should look similar to this example.

8. Compare the differences between the two export formats:• The report title in the RTF version is in a text box; the report title in the Editable version

is not.• The RTF version is larger in size (approximately 1.62MB); the Editable version is smaller

at 278 KB.

263Distributing a Report—Learner’s Guide

Page 280: BOC310 en Col91 FV Part Ltr Marca

Saving to BusinessObjects EnterpriseYou can use design options and considerations that will help improve the performance of yourreports.

After completing this unit, you will be able to:

• Define viewing requirements in BusinessObjects Enterprise• Save a report to BusinessObjects Enterprise• View a report in BusinessObjects Enterprise

Viewing requirements in BusinessObjects Enterprise

When designing your reports, and especially when designing reports for the web, you shouldallow report users to drive the data they see. In other words, display summarized information,so each user can navigate the report quickly and then drill down to access additional data. Inthis way, web traffic and response times are minimized, because only the data requested bythe user is transferred from the database server.

These are only a few of the benefits of designing user-driven reports:• Report users gain interactive control over the type and quantity of information they view

over the web.• Data transfer and network traffic decrease, because only the information requested by users

is returned from the database server.• When users need real-time reporting of live data over theweb, user-oriented reports respond

quickly and communicate efficiently with the database server.• Reports become more useful, because each user customizes the report’s contents, thereby

creating a reporting solution specific to his or her particular decision-making problem.

Some of the methods you can use to design optimized reports for viewing in BusinessObjectsEnterprise are:• Using faster report formats• Choosing between live and saved data• Designing summary reports

Using faster report formats

The quickest way to improve the performance of reports created in older versions of CrystalReports is to save them in the latest Crystal Reports format. It is recommended that you updateyour older reports to take advantage of these enhancements.

To update the format of an older report, open it in Crystal Reports and select Save from theFilemenu. The older version of the report will be replaced with the newer version report.

Note: If for some reason you need to keep a report in its original file format, use the Save Ascommand (instead of Save) and enter a new name for the newer version report.

Fundamentals of Report Design—Learner’s Guide264

Page 281: BOC310 en Col91 FV Part Ltr Marca

Choosing between live and saved data

When reporting over the web, the choice to use live or saved data is one of the most importantdecisions you’ll make. Whichever choice you make, Crystal Reports displays the first page asquickly as possible, so you can see your report while the rest of the data is being processed.

Live data

Live reporting gives users real-time access to live data, straight from the database server. Uselive data to keep users up-to-date on constantly changing data, so they can access informationthat’s accurate to the second. For instance, if the managers of a large distribution center needto keep track of inventory shipped on a continual basis, then live reporting is the way to givethem the information they need.

Crystal Reports supports live reporting. However, you should first consider whether or notyou want all of your users accessing the database server on a continual basis. If the data isn’trapidly or constantly changing, then all those requests to the database do little more thanincrease network traffic and consume server resources. In such cases, you may prefer to usereports with saved data.

Saved data

Reports with saved data are useful for dealing with data that isn’t continually updated. Whenusers navigate through reportswith saved data, and drill down for details on columns or charts,they don’t access the database server directly; instead, they access the saved data. Consequently,reports with saved data not only minimize data transfer over the network, but also lighten thedatabase server’s workload.

You can schedule these reportswithin BusinessObjects Enterprise, so they automatically refreshfrom the database on a predetermined basis. For example, if your sales database is only updatedonce a day, or once a week, then you can run the report on a similar schedule and save it withdata. Sales representatives then always have access to current sales data, but they aren’t hittingthe database every time they open a report. Alternatively, you can refresh reports with saveddata on an as-needed basis.

Saved data is discarded and refreshed when you perform any of these tasks in a report:• Select the Refresh command.• Change your database logon.• Change the report’s parameters.• Add a new field that doesn’t exist in the saved data.• Drill down in a report where Perform Grouping On Server is selected, and the Details

section is suppressed.• Verify the database—if the database structure has changed drastically.• Change the linking parameter on a subreport (the subreport is refreshed).• Change the order of groups (only for reports in the Report Application Server).

To save a report with data, first make sure the Save Data with Report option is selected on theFilemenu and then save your report.

265Distributing a Report—Learner’s Guide

Page 282: BOC310 en Col91 FV Part Ltr Marca

Designing summary reports

Designing and distributing summary reports is a relatively easy way to ensure that usersquickly find the data they need over the web. A summary report can include as much data asany other report. However, by hiding a summary report’s Details section, you avoidoverwhelming users with data they may not immediately need.

When theDetails section is hidden, users navigatewith theGroup tree first, to locate the desireddata. Then, by drilling down on the report, users can request specific data, which is returnedquickly without unnecessary records. This is especially important to improving navigation oflong summary reports, whichmight consist of hundreds, thousands, or even tens of thousandsof pages.

To facilitate navigation in this way, you first need to group the data and insert the summaryfields you want to include in your report. Once you’ve grouped and summarized your reportdata, hide the Details section (and any other large report sections) so that users can easilynavigate to the data that’s important to them.

Saving a report to BusinessObjects Enterprise

Another way to distribute your reports is through BusinessObjects Enterprise. When youpublish a report to BusinessObjects Enterprise, you can deliver it to end users via any webapplication—intranet, extranet, Internet, or corporate portal.

Crystal Reports facilitates the publication of reports through the Enterprise option found intheOpen and Save As dialog boxes. When you choose the Enterprise option in theOpendialog box, you can select any published report to make changes to it. The same option in theSave As dialog box lets you save a modified report back to its original location, or it lets yousave a new report to an Enterprise folder, which, in essence, is the same as publishing the reportto BusinessObjects Enterprise.

You can save Crystal reports to BusinessObjects Enterprise folders. Use the Save As dialog boxto save a modified report back to its original location, or use it to save a new report to anEnterprise folder. Saving a report to an Enterprise folder is the same as publishing the reportto BusinessObjects Enterprise.

You can also view the report in BusinessObjects Enterprise InfoView, the front-end interfaceto BusinessObjects Enterprise.

Note: This functionality is available only with a BusinessObjects Enterprise XI 3.0/3.1 serverenvironment.

To save a report to an Enterprise folder

1. On the Filemenu, click Save As.

2. In the Save As dialog box, click Enterprise.

Note: The Enterprise button is not visible if Crystal Reports doesn’t detect BusinessObjectsEnterprise on your machine.

Fundamentals of Report Design—Learner’s Guide266

Page 283: BOC310 en Col91 FV Part Ltr Marca

If you have not already logged onto BusinessObjects Enterprise, the Log On toBusinessObjects Enterprise dialog box appears.

Tip: You can also log onto a Central Management Server (CMS) from the Filemenu beforeyou open a report.

3. In the System field, enter or select the name of the BusinessObjects Enterprise system thatyou want to connect to.

4. Enter your user name and password.

5. Click the Authentication list to select the appropriate authentication type.

Enterprise authentication requires a user name and password that is recognized by CrystalEnterprise.

LDAP authentication requires a user name and password that is recognized by an LDAPdirectory server.

Windows AD authentication requires a user name and password that is recognized byWindows AD.

Windows NT authentication requires a user name and password that is recognized byWindows NT.

Note: Enterprise authentication is the default method. LDAP, AD, and NT Authenticationrequires special setup.

6. When the Enterprise folders appear, select a folder to save your report in.You can also create a new folder in which to save your report.

7. Enter a file name for your report, if required.

8. Select Enable repository refresh if you want your report’s repository objects to be updatedwhen the report is opened again in Crystal Reports or scheduled in BusinessObjectsEnterprise.

9. Click Save to publish your report to BusinessObjects Enterprise.

267Distributing a Report—Learner’s Guide

Page 284: BOC310 en Col91 FV Part Ltr Marca

To view a report in an Enterprise folder

1. On the Filemenu, clickOpen.

2. In theOpen dialog box, click Enterprise.

3. In the System field, enter or select the name of the BusinessObjects Enterprise system thatyou want to connect to.

4. Enter your user name and password.

5. Click the Authentication list to select the appropriate authentication type.

6. ClickOK.The Enterprise folders appear and you can select a report to open in Crystal Reports.

7. Double-click the report you want to view and then clickOpen.

Note:

• To find a specific report, highlight a folder and select Find from its shortcut menu. Youcan then use the Find dialog box to enter the report’s name or a part of its name.

• To limit the risk of expanding a folder than contains many hundreds of reports, use thebatch options on the folder’s shortcut menu:○ First Batch displays the first 100 objects in the selected folder.○ Next Batch displays the next 100 objects in the selected folder.○ Previous Batch displays the previous 100 objects in the selected folder.○ Last Batch displays the last 100 objects in the selected folder.

• Select theUpdate RepositoryObjects option to ensure that the report’s repository objectsare updated when the report is opened in the future.

To view a report in BusinessObjects Enterprise

1. Launch BusinessObjects Enterprise InfoView.

The Logon page appears.

2. In the Existing User area of the Logon page, type your user name and password.

3. Click the Authentication list to select Enterprise, LDAP, Windows AD, or Windows NTAuthentication.

4. Click Log On.

The home page reappears and you are logged on with your own account.

5. Locate the report in the folder in the list.

6. Double-click the report link to open and view the report.

Fundamentals of Report Design—Learner’s Guide268

Page 285: BOC310 en Col91 FV Part Ltr Marca

Activity: Saving a report to BusinessObjects Enterprise

Objective

• Save a report to a folder in BusinessObjects Enterprise and then view the report inBusinessObjects Enterprise InfoView.

Instructions

1. Open the Distributing a Report-1.rpt starting point report.

2. Modify the summary info section of the report to include the author name.

3. Save the report as Distributing a Report.rpt. Save the report with data so you can viewit in BusinessObjects Enterprise.

4. Save the report to your Favorites folder in BusinessObjects Enterprise by using theEnterprise folder option in the Save dialog box.

5. Open BusinessObjects InfoView.

6. Log on to BusinessObjects Enterprise.

7. Locate the report you saved.

8. View the report in BusinessObjects Enterprise.

269Distributing a Report—Learner’s Guide

Page 286: BOC310 en Col91 FV Part Ltr Marca

Quiz: Distributing a report1. The exporting process requires you to specify and .

2. What are the two methods to access and view a report in BusinessObjects Enterprise?

3. When designing reports that will be viewed in BusinessObjects Enterprise, what are someof the methods used to optimize reports?

4. What does it mean if the Enterprise button is not visible in Crystal Reports?

5. What option would you use to ensure that the report’s repository objects are updatedwhenthe report is opened in the future?

Fundamentals of Report Design—Learner’s Guide270

Page 287: BOC310 en Col91 FV Part Ltr Marca

Lesson summaryAfter completing this lesson, you are now able to:

• Export a report• Save a report to BusinessObjects Enterprise

271Distributing a Report—Learner’s Guide

Page 288: BOC310 en Col91 FV Part Ltr Marca

Fundamentals of Report Design—Learner’s Guide272

Page 289: BOC310 en Col91 FV Part Ltr Marca

Answer Key

This section contains the answers to the reviews and/or activities for the applicable lessons.

273Answer Key—Learner’s Guide

Page 290: BOC310 en Col91 FV Part Ltr Marca

Fundamentals of Report Design—Learner’s Guide274

Page 291: BOC310 en Col91 FV Part Ltr Marca

Debrief: Planning a reportPage 8

1. Why is it important to plan a report before creating it?

Answer:○ By taking a systems-oriented approach to reporting, you will produce clearer and more

readable reports.○ It’s a best practice to document processes, especially if workingwith a client (even if that

client is internal to the organization).○ If a group is working on a project, then the group’s work can be documented and they

can see a “snapshot” of the report if it’s been documented.○ If someone leaves the team for any reason and you need to take over the project, then

you’ll have a record/document of where the other report designer left off.○ The prototype can flag any problems that may occur (technical, data access, client

misunderstandings, and so on).○ The prototype can constitute a “sign off” point in the report creation process.

275Answer Key—Learner’s Guide

Page 292: BOC310 en Col91 FV Part Ltr Marca

Quiz: Creating a reportPage 67

1. What is the difference between using theDesign tab and Preview tab?

Answer:

When you place a field in theDesign tab, a single-field frame represents all those values.When you highlight the field, sizing handles appear on the frame and the frame changescolor.

In the Preview tab, however, you are working with the actual data. Instead of a field framerepresenting many field values, the values themselves appear.

2. What is the difference between using Print Preview and Refresh?

Answer:

When you preview the report, the program uses the data that is saved in a cache file withthe report on the client machine.

When you refresh the report, the program retrieves new data and displays this new dataon the report.

3. What objects can be stored in the repository?

Answer:The repository stores text objects, bitmaps, custom functions, commands (queries),and lists of values.

4. What is theWorkbench?

Answer: TheWorkbench is a folder structure that can represent the type of projects youwork on. In theWorkbench, you can create projects (folders) that contain one or morereports.

5. How do you select multiple report objects?

Answer:○ Crtl-click each object in succession.○ You can also use the cursor to click and hold to draw an imaginary box around the objects

you want selected. When you release the mouse, all objects partially surrounded by themarquee are selected.

○ Click in the section, and then click Select All Section Objects.

Fundamentals of Report Design—Learner’s Guide276

Page 293: BOC310 en Col91 FV Part Ltr Marca

Quiz: Selecting recordsPage 91

1. What tool is used for filtering or selecting records in Crystal Reports?

Answer: The Select Expert

2. When you want to see new data from the database after modifying the record selection,what option would you use?

Answer: You would use the Refresh option because the program will run the report againand retrieve fresh data if you add to the record selection criteria to include more recordsthan were needed when you first ran the report.

3. Why would you want to ensure your record selection is case insensitive?

Answer: You will want to ensure that your record selection statement is case insensitive ifyou are not confident that data entry was consistent.

4. When would you use a time-based record selection?

Answer: You would use a time-based record selection when you wanted to determinespecific results in a given time period.

5. When youwant to refresh the data on your report, what are the threemethods you can use?

Answer:

You can use:○ The Refresh button on the Standard toolbar.○ The Refresh Report Data command from the Reportmenu.○ F5 on the keyboard.

277Answer Key—Learner’s Guide

Page 294: BOC310 en Col91 FV Part Ltr Marca

Quiz: Organizing data on a reportPage 126

1. Can each field in the Sort Fields list be assigned a sort direction in ascending or descendingorder independently?

Answer: Yes

2. What is the function of the Group Tree?

Answer: The Group Tree functions like a directory tree with a heading for each group inyour report, with the ability to expand the group to see further levels of grouping. Usingthe Group Tree aids in navigating through the report.

3. How would you create groups that are not reflected by the fields in your database?

Answer: You would create a specified order group, which enables you to create both thecustomized groups that will appear on the report and the records that each group willcontain.

4. Why would you want to have the group header repeat on every page?

Answer:○ Makes the report more readable and usable.○ Helps to navigate the report.

5. What is the difference between a subtotal and a summary?

Answer:

A subtotal is a summary that totals or sums numeric values in a group.

When the program summarizes data, it sorts the data, breaks it into meaningful groups,and then summarizes the values in each group automatically.

Fundamentals of Report Design—Learner’s Guide278

Page 295: BOC310 en Col91 FV Part Ltr Marca

Quiz: Formatting a reportPage 166

1. The Format Painter copies formatting properties from one report object to one or moretarget objects when you first select a source object in a report and then apply that object’sformatting to a target field.

2. The Template Expert gives any number of reports a consistent lookwithout having to formateach report individually.

3. Graphical elements such as lines, boxes, and picturesmake specific data stand out and improvethe overall appearance of the report.

4. The Can Grow option prevents truncation of text objects to allow the text box to expandvertically to fit all text and data from embedded fields.

5. To reduce the amount of time spent formatting reports by using fields that contain pre-builtfunctions, use Special Fields.

279Answer Key—Learner’s Guide

Page 296: BOC310 en Col91 FV Part Ltr Marca

Quiz: Applying section formattingPage 183

Exercise one

1. True or False: TheNew Page Before and theNew Page After option is usually used withGroup Headers andGroup Footers.

Answer: True

2. What option prevents page breaks from spreading data from a single record over two pages?

Answer: Keep Together

3. If youwant to lock the formatting and position of all report objects in a section, what optiondo you use in the Section Expert?

Answer: Read-only

Exercise two

1. Who are the customers in the New South Wales region of Australia?

Answer: Canberra Bikes and Down Under Bikes

2. What is the street address for the Offroad Bike Verlieh in Berlin?

Answer: Koningswinterer Strasse 800

3. What is the phone number for the Picadilly Cycle in Greater London?

Answer: 44-171-531-0221

Fundamentals of Report Design—Learner’s Guide280

Page 297: BOC310 en Col91 FV Part Ltr Marca

Quiz: Applying conditional reportingPage 225

1. When you need to format objects only in certain cases or apply formatting differently fordifferent situations, you use conditional formatting.

2. What type of formula do you need to create when you set an on or off property?

Answer: Boolean

3. What type of formula do you need to create when you apply an attribute property?

Answer: If-Then-Else

4. When would you use a conditional formatting function?

Answer:Youwould use a conditional formatting function (found at the top of the Functionstree in the Formula Workshop) whenever you needed to create more complex conditionalformatting than is available in theHighlighting Expert.

281Answer Key—Learner’s Guide

Page 298: BOC310 en Col91 FV Part Ltr Marca

Quiz: Representing data visuallyPage 250

1. What functionality would you use when you have multiple chart values or when you donot have any group or summary fields in the report?

Answer: You would use the Advanced chart layout when you have multiple chart valuesor when you do not have any group or summary fields in the report.

2. What functionality would you use when you want to set the appearance, titles, data labels,or legend of the chart?

Answer:Youwould use theChartOptionsdialog boxwhen youwant to set the appearance,titles, data labels, or legend of the chart.

3. What functionality would you use when you want to set conditional color formatting?

Answer: You would use the Color Highlight tab of the Chart Expertwhen you want to setconditional color formatting.

4. What functionality would you use when you need to see the details behind summaryinformation in a bar chart?

Answer: You would use drill-down when you need to see the details behind summaryinformation in a bar chart.

5. What functionality would you use when you want to create a chart based on detailinformation?

Answer: You would use a condition (when to plot the point) and a value (what is plottedas a point) when you want to create a chart based on detail information.

Fundamentals of Report Design—Learner’s Guide282

Page 299: BOC310 en Col91 FV Part Ltr Marca

Quiz: Distributing a reportPage 270

1. The exporting process requires you to specify format and destination.

2. What are the two methods to access and view a report in BusinessObjects Enterprise?

Answer:○ Enterprise Folders○ InfoView

3. When designing reports that will be viewed in BusinessObjects Enterprise, what are someof the methods used to optimize reports?

Answer:○ Using faster report formats○ Choosing between live and saved data○ Designing summary reports

4. What does it mean if the Enterprise button is not visible in Crystal Reports?

Answer:TheEnterprise button is not visible if Crystal Reports doesn’t detect BusinessObjectsEnterprise on your machine.

5. What option would you use to ensure that the report’s repository objects are updatedwhenthe report is opened in the future?

Answer: Select theUpdate RepositoryObjects option to ensure that the report’s repositoryobjects are updated when the report is opened in the future.

283Answer Key—Learner’s Guide

Page 300: BOC310 en Col91 FV Part Ltr Marca

Fundamentals of Report Design—Learner’s Guide284