BOCE10 - Crystal Reports - Fundamentals of Report Design

349
BOCE10 Crystal Reports: Fundamentals of Report Design other solution Date Training Center Instructors Education Website Participant Handbook Course Version: 96 Course Duration: 2 Days Material Number: 50106135 An SAP course - use it to learn, reference it for work

Transcript of BOCE10 - Crystal Reports - Fundamentals of Report Design

Page 1: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10Crystal Reports: Fundamentals of

Report Designother solution

Date

Training Center

Instructors

Education Website

Participant HandbookCourse Version: 96Course Duration: 2 DaysMaterial Number: 50106135

An SAP course - use it to learn, reference it for work

Page 2: BOCE10 - Crystal Reports - Fundamentals of Report Design

Copyright

Copyright © 2011 SAP AG. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without theexpress permission of SAP AG. The information contained herein may be changed without prior notice.

Some software products marketed by SAP AG and its distributors contain proprietary softwarecomponents of other software vendors.

Trademarks

• Microsoft®, WINDOWS®, NT®, EXCEL®, Word®, PowerPoint® and SQL Server® areregistered trademarks of Microsoft Corporation.

• IBM®, DB2®, OS/2®, DB2/6000®, Parallel Sysplex®, MVS/ESA®, RS/6000®, AIX®, S/390®,AS/400®, OS/390®, and OS/400® are registered trademarks of IBM Corporation.

• ORACLE® is a registered trademark of ORACLE Corporation.• INFORMIX®-OnLine for SAP and INFORMIX® Dynamic ServerTM are registered trademarks

of Informix Software Incorporated.• UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of the Open Group.• Citrix®, the Citrix logo, ICA®, Program Neighborhood®, MetaFrame®, WinFrame®,

VideoFrame®, MultiWin® and other Citrix product names referenced herein are trademarks ofCitrix Systems, Inc.

• HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C®, World WideWeb Consortium, Massachusetts Institute of Technology.

• JAVA® is a registered trademark of Sun Microsystems, Inc.• JAVASCRIPT® is a registered trademark of Sun Microsystems, Inc., used under license for

technology invented and implemented by Netscape.• SAP, SAP Logo, R/2, RIVA, R/3, SAP ArchiveLink, SAP Business Workflow, WebFlow, SAP

EarlyWatch, BAPI, SAPPHIRE, Management Cockpit, mySAP.com Logo and mySAP.com aretrademarks or registered trademarks of SAP AG in Germany and in several other countries allover the world. All other products mentioned are trademarks or registered trademarks of theirrespective companies.

Disclaimer

THESE MATERIALS ARE PROVIDED BY SAP ON AN "AS IS" BASIS, AND SAP EXPRESSLYDISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR APPLIED, INCLUDING WITHOUTLIMITATION WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE, WITH RESPECT TO THESE MATERIALS AND THE SERVICE, INFORMATION, TEXT,GRAPHICS, LINKS, OR ANY OTHER MATERIALS AND PRODUCTS CONTAINED HEREIN. INNO EVENT SHALL SAP BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL,CONSEQUENTIAL, OR PUNITIVE DAMAGES OF ANY KIND WHATSOEVER, INCLUDINGWITHOUT LIMITATION LOST REVENUES OR LOST PROFITS, WHICH MAY RESULT FROMTHE USE OF THESE MATERIALS OR INCLUDED SOFTWARE COMPONENTS.

g20118133818

Page 3: BOCE10 - Crystal Reports - Fundamentals of Report Design

About This HandbookThis handbook is intended to complement the instructor-led presentation of thiscourse, and serve as a source of reference. It is not suitable for self-study.

Typographic ConventionsAmerican English is the standard used in this handbook. The following typographicconventions are also used.

Type Style Description

Example text Words or characters that appear on the screen. Theseinclude field names, screen titles, pushbuttons as well asmenu names, paths, and options.

Also used for cross-references to other documentationboth internal and external.

Example text Emphasized words or phrases in body text, titles ofgraphics, and tables

EXAMPLE TEXT Names of elements in the system. These include reportnames, program names, transaction codes, table names,and individual key words of a programming language,when surrounded by body text, for example SELECTand INCLUDE.

Example text Screen output. This includes file and directory namesand their paths, messages, names of variables andparameters, and passages of the source text of a program.

Example text Exact user entry. These are words and characters thatyou enter in the system exactly as they appear in thedocumentation.

<Example text> Variable user entry. Pointed brackets indicate that youreplace these words and characters with appropriateentries.

2011 © 2011 SAP AG. All rights reserved. iii

Page 4: BOCE10 - Crystal Reports - Fundamentals of Report Design

About This Handbook BOCE10

Icons in Body TextThe following icons are used in this handbook.

Icon Meaning

For more information, tips, or background

Note or further explanation of previous point

Exception or caution

Procedures

Indicates that the item is displayed in the instructor'spresentation.

iv © 2011 SAP AG. All rights reserved. 2011

Page 5: BOCE10 - Crystal Reports - Fundamentals of Report Design

ContentsCourse Overview ............................................................................. vii

Course Goals.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .viiCourse Objectives ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .vii

Unit 1: Planning a Report.....................................................................1Defining database concepts.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2Planning and developing a report prototype ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5

Unit 2: Requirements to build a report .................................................. 21Logon to SAP Business Objects Enterprise... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22Select a Data Source... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Unit 3: Creating a Report ................................................................... 37Connecting to a Data Source ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38Create a query to retrieve data from the data source... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40Using the Report Design Environment.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42Report Sections ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45Working with field objects.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Save a report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

Unit 4: Report Layout and Formatting................................................... 65Setting Page properties .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66Formatting options... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

Unit 5: Selecting Data ....................................................................... 81Editing a query .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82Inserting additional filter conditions... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89Modifying query filters .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94Applying time based filters.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101

Unit 6: Sorting, Grouping and Totalling ................................................ 111Sorting Data ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112Grouping data ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .121Create nested and multiple groups... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127Create a custom group... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132

2011 © 2011 SAP AG. All rights reserved. v

Page 6: BOCE10 - Crystal Reports - Fundamentals of Report Design

Contents BOCE10

Group on time-based data... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135Total grouped data... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .140Total column data ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147

Unit 7: Additional Report Objects .......................................................159Predefined Objects .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160Graphical Objects.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163

Unit 8: Formulas .............................................................................177Formulas overview ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179Working with the Formula Workshop... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183Creating and modifying formulas ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187Applying Boolean formulas ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191Applying If-Then-Else formulas ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197Applying date calculations... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202Applying numeric calculations ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211Applying string manipulation ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .220

Unit 9: Conditional Formatting ...........................................................233Formatting Objects conditionally.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234Formatting Fields conditionally with formulas ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241Formatting Sections ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247Formatting Sections conditionally .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252Drill down on Sections ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .258

Unit 10: Charting.............................................................................269Charting Concepts.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .270Charting on grouped data ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .276Creating a chart on detailed data ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .284Formatting Charts .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288

Unit 11: Distributing Reports .............................................................299Exporting a report. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .300Saving to SAP BusinessObjects Business Intelligence Platform... . . . . . . . . . . . . . . . . .310

vi © 2011 SAP AG. All rights reserved. 2011

Page 7: BOCE10 - Crystal Reports - Fundamentals of Report Design

Course Overview[Enter a brief overview of the course.]

Target AudienceThis course is intended for the following audiences:

• The target audience for this course is report designers who need to create anddistribute Crystal Reports.

Course PrerequisitesRequired Knowledge

• Windows conventions

Recommended Knowledge

• Basic database concepts

Course GoalsThis course will prepare you to:

• Learn how to create, modify and enhance a Crystal Report

Course ObjectivesAfter completing this course, you will be able to:

• Create, modify and enhance a Crystal Report

2011 © 2011 SAP AG. All rights reserved. vii

Page 8: BOCE10 - Crystal Reports - Fundamentals of Report Design

Course Overview BOCE10

viii © 2011 SAP AG. All rights reserved. 2011

Page 9: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 1Planning a Report

Unit Overview[Enter a brief overview of the unit.]

Unit ObjectivesAfter completing this unit, you will be able to:

• Define database terms• Determine the layout and content of a report• Develop a prototype of a report• Determine the layout and content for a report and then develop a paper

prototype."

Unit ContentsLesson: Defining database concepts.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2Lesson: Planning and developing a report prototype ... . . . . . . . . . . . . . . . . . . . . . . . . . .5

Exercise 1: Developing a report prototype ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9

2011 © 2011 SAP AG. All rights reserved. 1

Page 10: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 1: Planning a Report BOCE10

Lesson: Defining database concepts

Lesson OverviewIn this lesson, we will define database concepts

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Define database terms

Business Example

Database terms and definitionsBefore starting to work with Crystal Reports for Enterprise it is useful to clarify someterms and definitions that are used in the documentation and in this training guide.Here you find a compact overview of the ones the are mostly used.

Term Definition

Data Source A data source is a physical storage forthe data that shall be used for reporting.

Object A object is the basic building unit of arecord. Each object can hold one pieceof data (known as a value).

Universe A universe serves as a Semantic layerbetween the data source and the frontend tool, in this case Crystal Reports forEnterprise. It presents objects from oneor more relational data sources or OLAPcubes.

2 © 2011 SAP AG. All rights reserved. 2011

Page 11: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Defining database concepts

Query A query is the definition for a datarequest. It includes result objects andusually filters and prompts.

Record A record is a complete unit of relatedinformation. Each record is made up ofone or more objects.

Report A report is an organized presentationof data. A comprehensive, customized,and attractive report can providemanagement with the information itneeds to run an organization effectively.

2011 © 2011 SAP AG. All rights reserved. 3

Page 12: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 1: Planning a Report BOCE10

Lesson Summary

You should now be able to:• Define database terms

4 © 2011 SAP AG. All rights reserved. 2011

Page 13: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Planning and developing a report prototype

Lesson: Planning and developing a report prototype

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

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

prototype."

Business ExampleA report developer may not be the viewer of the report. Gathering report requirementsfrom the viewer will give the developer an idea of where to begin designing a newreport.

Report prototype layoutsBy taking a systems-oriented approach to reporting and developing a prototype, youwill produce clearer and more readable reports.

Hint: With the paper prototype in hand, you can put your full effort intolearning and using the program, rather than trying to design and learn at thesame time. For more details on the report planning process, see the CrystalReports for Enterprise User’s Guide.

Developing a report prototypeTo develop a report prototype, gather the information on which the report will bebased. This stage of the report planning process, referred to as requirements gathering,consists of the report designer asking the report requestor a series of targetedquestions, sometimes in the form of a checklist.

2011 © 2011 SAP AG. All rights reserved. 5

Page 14: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 1: Planning a Report BOCE10

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 willbe printed

• Filling in a form.

Sketching the report helps if you need to see the report visually; however, a formwith all the categories listed enables you to develop the prototype without missing asection. As well, the form is more professional than a quickly sketched visual and canbe used as a sign-off point in a report request. Having a list of questions (based on theReport Requirements Checklist) can also help to keep you on track.

Note: The Report Requirements Checklist is based on Crystal Reportsterminology. Use this checklist as a starting point for a version specific toyour organization’s needs.

Report Requirements ChecklistYou 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 thereport both a starting point and a goal.

• Define the readers of the report. Plan the report so it includes the informationeach 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 atleast you will 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 titleof the report. 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 purposeyou wrote for the report. It should also contain all of the data needed by thevarious users that you have identified.

• Determine if the data is organized into groups.

6 © 2011 SAP AG. All rights reserved. 2011

Page 15: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Planning and developing a report prototype

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 from data fields; otherinformation will have to 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 setof records from the database.

• Determine if the data needs to be summarized.

Do you want to total, average, count, or determine the maximum or minimumvalue included in all the values in any column on the report? Do you want toinclude a grand total at the bottom 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?

2011 © 2011 SAP AG. All rights reserved. 7

Page 16: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 1: Planning a Report BOCE10

8 © 2011 SAP AG. All rights reserved. 2011

Page 17: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Planning and developing a report prototype

Exercise 1: Developing a report prototype

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Determine Report RequirementsRead through the scenario to determine the basic requirements of the report. Then,create a report prototype.

Scenario

You are a new report designer for the Sales team in a bike manufacturing companycalled the Xtreme Bike Company. Your first assignment is to create a report that willdisplay orders placed by each customer of the organization.

The database administrator tells you that the customer information and the orderinformation are stored in two separate tables in the Xtreme company database. Youare advised to use an ODBC connection to the database.

The sales manager tells you that the standard is to use the company logo at the of thereport as well as a title and print data that is labeled. Other corporate standards includea page number that is labeled at the bottom of the report and copyright information.

The main section of the report should contain the customer's name and city. Thecustomer's order information should include the date the order was placed, the amountof the order, and the order ID number.

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

The report should display USA as the only country group. The only regional groupsrequired are Western Sales Territory and the Eastern Sales Territory. All otherregions can be listed under Unassigned Regions. Also, the Sales team wants to seeinformation grouped on the dates that orders were placed with the order dates sortedwith the most recent information first.

Continued on next page

2011 © 2011 SAP AG. All rights reserved. 9

Page 18: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 1: Planning a Report BOCE10

The Sales team also needs to see such summarized data as the number of orders foreach order date group. Include the subtotal of the order amount for each order dategroup as well as a report grand total for the order amount. Include a percentage ofthe order amount based on each month's subtotal compared to the grand total. Alsoinclude the number of unique customers.

To highlight key information with specialized formatting options, ensure the orderdate group as well as the subtotal and grand total is easily found on the report. Formatthe column headings, so that navigating the report is easier. Use two different fontstyles for the report title for contrast.

1. Work through the scenario to determine the basic requirements of a report.Read through the scenario and then create a report prototype. You can use thefollowing Report Prototype Form as an aid in this activity or sketch the reportprototype on a piece of paper.

Report Prototype Form

Report Prototype Form

Purpose

Audience Report title

Database information

Header information Footer information

Body of report (information to be included in the body of the report)

Continued on next page

10 © 2011 SAP AG. All rights reserved. 2011

Page 19: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Planning and developing a report prototype

Groups (groups to be set up)

Sorting (Information to be sorted in aspecific order)

Record selection (Specific records tobe displayed)

Calculations or formulas

Summarized data (Summarized data to be included)

Key information/Formatting (Formatting to highlight specific information)

Signoff:

2. Build a report prototype.

ResultYou now have a list of report requirements and a prototype of the content andlayout.

2011 © 2011 SAP AG. All rights reserved. 11

Page 20: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 1: Planning a Report BOCE10

Solution 1: Developing a report prototypeTask: Determine Report RequirementsRead through the scenario to determine the basic requirements of the report. Then,create a report prototype.

Scenario

You are a new report designer for the Sales team in a bike manufacturing companycalled the Xtreme Bike Company. Your first assignment is to create a report that willdisplay orders placed by each customer of the organization.

The database administrator tells you that the customer information and the orderinformation are stored in two separate tables in the Xtreme company database. Youare advised to use an ODBC connection to the database.

The sales manager tells you that the standard is to use the company logo at the of thereport as well as a title and print data that is labeled. Other corporate standards includea page number that is labeled at the bottom of the report and copyright information.

The main section of the report should contain the customer's name and city. Thecustomer's order information should include the date the order was placed, the amountof the order, and the order ID number.

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

The report should display USA as the only country group. The only regional groupsrequired are Western Sales Territory and the Eastern Sales Territory. All otherregions can be listed under Unassigned Regions. Also, the Sales team wants to seeinformation grouped on the dates that orders were placed with the order dates sortedwith the most recent information first.

The Sales team also needs to see such summarized data as the number of orders foreach order date group. Include the subtotal of the order amount for each order dategroup as well as a report grand total for the order amount. Include a percentage ofthe order amount based on each month's subtotal compared to the grand total. Alsoinclude the number of unique customers.

Continued on next page

12 © 2011 SAP AG. All rights reserved. 2011

Page 21: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Planning and developing a report prototype

To highlight key information with specialized formatting options, ensure the orderdate group as well as the subtotal and grand total is easily found on the report. Formatthe column headings, so that navigating the report is easier. Use two different fontstyles for the report title for contrast.

1. Work through the scenario to determine the basic requirements of a report.Read through the scenario and then create a report prototype. You can use thefollowing Report Prototype Form as an aid in this activity or sketch the reportprototype on a piece of paper.

Report Prototype Form

Report Prototype Form

Purpose

Audience Report title

Database information

Header information Footer information

Body of report (information to be included in the body of the report)

Groups (groups to be set up)

Continued on next page

2011 © 2011 SAP AG. All rights reserved. 13

Page 22: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 1: Planning a Report BOCE10

Sorting (Information to be sorted in aspecific order)

Record selection (Specific records tobe displayed)

Calculations or formulas

Summarized data (Summarized data to be included)

Key information/Formatting (Formatting to highlight specific information)

Signoff:

2. Build a report prototype.

a) Go to the BOCE10 resource folders as initialized in the trainingsystem landscape. Click Start -> My Documents -> BOCE10 ->Activity_Resources -> Unit 1.

As a solution, refer to the following files:

• ReportProtoype.SWF as an interactive Flash file on developing areport prototype

• Report Prototype Form.pdf as a job aid• Report Requirements Checklist.pdf as a job aid

ResultYou now have a list of report requirements and a prototype of the contentand layout.

14 © 2011 SAP AG. All rights reserved. 2011

Page 23: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Planning and developing a report prototype

Lesson Summary

You should now be able to:• Determine the layout and content of a report• Develop a prototype of a report• Determine the layout and content for a report and then develop a paper

prototype."

2011 © 2011 SAP AG. All rights reserved. 15

Page 24: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

Unit SummaryYou should now be able to:• Define database terms• Determine the layout and content of a report• Develop a prototype of a report• Determine the layout and content for a report and then develop a paper

prototype."

16 © 2011 SAP AG. All rights reserved. 2011

Page 25: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Test Your Knowledge

Test Your Knowledge

2011 © 2011 SAP AG. All rights reserved. 17

Page 26: BOCE10 - Crystal Reports - Fundamentals of Report Design

Test Your Knowledge BOCE10

Answers

18 © 2011 SAP AG. All rights reserved. 2011

Page 27: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 28: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 29: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

19 © 2011 SAP AG. All rights reserved. 2011

Page 30: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

20 © 2011 SAP AG. All rights reserved. 2011

Page 31: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 2Requirements to build a report

Unit Overview[Enter a brief overview of the unit.]

Unit ObjectivesAfter completing this unit, you will be able to:

• Get to know the requirements to build a report with Crystal Reports for Enterprise• Define possible Data Sources

Unit ContentsLesson: Logon to SAP Business Objects Enterprise ... . . . . . . . . . . . . . . . . . . . . . . . . 22Lesson: Select a Data Source ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

2011 © 2011 SAP AG. All rights reserved. 21

Page 32: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 2: Requirements to build a report BOCE10

Lesson: Logon to SAP Business Objects Enterprise

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Get to know the requirements to build a report with Crystal Reports for Enterprise

Business Example•

Logon to SAP Business Objects EnterpriseBefore you can create a report with SAP Crystal Reports for Enterprise, you must beconnected to an SAP BusinessObjects Enterprise server.

22 © 2011 SAP AG. All rights reserved. 2011

Page 33: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Logon to SAP Business Objects Enterprise

To Logon to SAP Business Objects Enterprise for thefirst timeGet the correct Web Services server name from your SAP BusinessObjects Enterpriseadministrator. If you have not connected to SAP BusinessObjects Enterprise before,you will need to add the server connection before you can log on.

1. Click File > Log on to SAP BusinessObjects Enterprise. The "Log on to SAPBusinessObjects Enterprise" dialog box appears.

2. Type your User Name and Password.3. Click Options.4. Click Specify new server below and save.5. In Connection Name, type a descriptive name for the connection. For example,

type “Test server” or “Human Resources server”.6. Select the correct Authentication Type.7. Type the server name.

Note: You do not need to type the complete URL here, only the servername. If you need to change the web port number or server contextinformation, click Advanced to display the "Advanced Server Settings"dialog box. Ask your system administrator for the values to use for theweb port number or server context information.

8. Click OK.Note: If you cannot connect to the BusinessObjects Enterprise server, refer toyour Web Services administrator to ensure the connection to the Web Serviceserver is configured properly.

To Logon to SAP Business Objects EnterpriseFollow these steps if you have already set up server connections to SAPBusinessObjects Enterprise.

1. Click File > Log on to SAP BusinessObjects Enterprise.The "Log on to SAP BusinessObjects Enterprise" dialog box appears.

2. From the "Server Connections" list, click the server name for the server thatyou want to connect to.

3. Type in your User Name and Password and then click OK.

2011 © 2011 SAP AG. All rights reserved. 23

Page 34: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 2: Requirements to build a report BOCE10

You are now logged on to the SAP BusinessObjects Enterprise server. You can createnew reports or edit existing ones.

Note: If you cannot connect to the SAP BuisnessObjects Enterprise server,refer to your Web Services administrator to ensure the connection to the WebServices server is configured properly.

24 © 2011 SAP AG. All rights reserved. 2011

Page 35: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Logon to SAP Business Objects Enterprise

Lesson Summary

You should now be able to:• Get to know the requirements to build a report with Crystal Reports for Enterprise

2011 © 2011 SAP AG. All rights reserved. 25

Page 36: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 2: Requirements to build a report BOCE10

Lesson: Select a Data Source

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Define possible Data Sources

Business Example

Selecting a Data SourceCrystal Reports supports connecting to the following data sources:

• Universe• SAP BEx Query• Analysis view

26 © 2011 SAP AG. All rights reserved. 2011

Page 37: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Select a Data Source

To select a data sourceConnect to an SAP BusinessObjects Enterprise server.

1. You can select a data source when creating a new report, or add a data sourcelater.

• To add a data source to a new report, click Blank Report.• To add a data source to an existing report, click Data > Choose Data Source.

The “New Data Source Connection” dialog box appears.

2. Select one of the available data source types and click Next.3. If you are not already logged on, log on to your SAP BusinesssObjects Enterprise

server and click Next.Note: If you are already logged on, the login screen is not displayed.

4. Select the data source that you want to connect to, and then click Next.The “Edit Query”panel appears. You can now select elements to include inyour query.

Note: If you connect to an Anylsis View, the query panel will not appearbecause Analysis Views contain pre-designed queries. The report canvaswill appear.

Connecting to a UniverseUniverses include data from one or more relational data sources or OLAP cubes.You can base new documents and queries only on universes for which you have beengranted the right.

To connect to a universeBefore you connect to a universe, log on to an SAP BusinessObjects Enterprise server.

1. Click File > New Report.The “New Data Source Connection” dialog box appears.

2. From the “Data Source Typ” list, click Universe.3. On the “Name” panel, select a universe and select Next.

The “Query Panel” appears. You can noe select objects from the universe toinclude in your query.

2011 © 2011 SAP AG. All rights reserved. 27

Page 38: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 2: Requirements to build a report BOCE10

Connecting to a SAP Bex QueryEach SAP BEx query contains a group of pre-designed result objects that you can runreports on. Though the queries are pre-designed, you can use the "Query Panel" tosort and filter the query before you run the report.

SAP BEx queries are hierarchy-based and can have multiple hierarchies. For example,a query on expenses by region will create a different report than a query on expensesby employee. After you insert the result objects in your query, if your SAP BEx queryincludes a variable hierarchy, you must specify a hierarchy in order to run the report.

To connect to an SAP BEx queryBefore you connect to an SAP BEx query, log on to an SAP BusinessObjectsEnterprise server.

1. Click File > New Report.The “New Data Source Connection” dialog box appears.

2. From the “Data Source Type” list, click SAP BEx Query Data Access.3. On the “Name” panel, select an OLAP Connection and select Next.

The “Query Panel” appears. You can now select objects from the data source toinclude in your query.

4. Click Finish.5. (Optional) If the SAP BEx query you connected to is designed to include an SAP

server-side variable, a dialog box appears prompting you to enter the variableoption for your query.

Connecting to a Analysis ViewEach Analysis View contains a pre-designed query containing pre-designed resultobjects. Unlike universes or BEx queries, queries in an Analysis View cannot be editedin Crystal Reports. You can manipulate the data from an Analysis View by using thevarious Crystal Reports filtering and grouping features. To change the query itself,you need to open the Analysis View in SAP BusinessObjects Advanced Analysis.

28 © 2011 SAP AG. All rights reserved. 2011

Page 39: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Select a Data Source

To connect to an Analysis ViewBefore you connect to an Analysis View, log on to an SAP BusinessObjects Enterpriseserver.

1. Click File > New Report.The "New Data Source Connection" dialog box appears.

2. From the "Data Source Type" list, click Analysis View.3. On the "Name" panel, select a pre-defined analysis view and select Next.

The report canvas appears. You can now add result objects from the "DataExplorer" side panel to your report.

2011 © 2011 SAP AG. All rights reserved. 29

Page 40: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 2: Requirements to build a report BOCE10

Lesson Summary

You should now be able to:• Define possible Data Sources

30 © 2011 SAP AG. All rights reserved. 2011

Page 41: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Unit Summary

Unit SummaryYou should now be able to:• Get to know the requirements to build a report with Crystal Reports for Enterprise• Define possible Data Sources

2011 © 2011 SAP AG. All rights reserved. 31

Page 42: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

32 © 2011 SAP AG. All rights reserved. 2011

Page 43: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Test Your Knowledge

Test Your Knowledge

2011 © 2011 SAP AG. All rights reserved. 33

Page 44: BOCE10 - Crystal Reports - Fundamentals of Report Design

Test Your Knowledge BOCE10

Answers

34 © 2011 SAP AG. All rights reserved. 2011

Page 45: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 46: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 47: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

35 © 2011 SAP AG. All rights reserved. 2011

Page 48: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

36 © 2011 SAP AG. All rights reserved. 2011

Page 49: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 3Creating a Report

Unit Overview[Enter a brief overview of the unit.]

Unit ObjectivesAfter completing this unit, you will be able to:

• Connect to a Data Source• Create a query to retrieve data from the data source• Choose Result Objects• Use the report Design Enviroment• Place objects• Work with report structure and preview mode• Understand the relevance of sections• Get to know different sections• Position, align and resize field objects• Save a report as local file or save to an Enterprise folder

Unit ContentsLesson: Connecting to a Data Source ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38Lesson: Create a query to retrieve data from the data source... . . . . . . . . . . . . . . 40Lesson: Using the Report Design Environment.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42Lesson: Report Sections... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45Lesson: Working with field objects .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Lesson: Save a report. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

Exercise 2: Creating a report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

2011 © 2011 SAP AG. All rights reserved. 37

Page 50: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 3: Creating a Report BOCE10

Lesson: Connecting to a Data Source

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Connect to a Data Source

Business Example

To select a data sourceStart Crystal Reports for Enterprise in order to create a new Report and ClickFile > New Report

Connect to an SAP Business Objects Enterprise Server if not already connected.

Select one of the available Data Source types:

• Universe• SAP BEx Query• Analysis View

Select the data source that you want to connect to and then click next.

The “Edit Query” panel appears. You can now select elements to include in your query.

Note: If you connect to an Analysis View, the query panel will not appearbecause Analysis Views contain pre-designed queries. The report canvaswill appear.

38 © 2011 SAP AG. All rights reserved. 2011

Page 51: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Connecting to a Data Source

Lesson Summary

You should now be able to:• Connect to a Data Source

2011 © 2011 SAP AG. All rights reserved. 39

Page 52: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 3: Creating a Report BOCE10

Lesson: Create a query to retrieve data from the datasource

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Create a query to retrieve data from the data source• Choose Result Objects

Business Example

To build a simple query1. Select an object in the "Universe" pane and double-click it or drag it to the

"Result Objects" pane.

Note: Objects that are placed in the "Result Objects" pane become theobjects that your report will be based on.

2. Repeat the previous step for each object that you want to include in the query.3. (Optional) If you want to filter your query, select an object in the "Universe" or

"Result Objects" panes, and drag it to the "Filters" pane.4. Click Finish.

The report is generated. The data from the objects in the "Result Objects" and "Filters"panes are automatically formatted onto the report. The formatting time will varydepending on the size of your report.

40 © 2011 SAP AG. All rights reserved. 2011

Page 53: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Create a query to retrieve data from the data source

Lesson Summary

You should now be able to:• Create a query to retrieve data from the data source• Choose Result Objects

2011 © 2011 SAP AG. All rights reserved. 41

Page 54: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 3: Creating a Report BOCE10

Lesson: Using the Report Design Environment

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Use the report Design Enviroment• Place objects• Work with report structure and preview mode

Business Example

Placing Data on the reportPlacing data on a report is a very important task. To produce reports that are clearand effective, you need to know what type of data to place on the report and whereon the report to place it.

Note: A report (.rpt) file might contain sensitive business data. You areadvised to protect access to the file by using appropriate methods.

Typical Objects that display data on a report are: Result Objects, Formulas andParameters.

Result objects are objects that display data from the data source. Much of the datadisplayed on a report is from result objects. Normally, result objects will be placedin the "Body" area, but under certain circumstances, they will be placed in othersections of the report.

Note: If you are using a relational universe, OLAP universe, or SAP BExquery, delegated measures may be available. If you place a delegated measurein the "Body" area, it will appear as a result object. However, if you place adelegated measure in the "Report Header", "Report Footer", "Group Header","Group Footer", a Cross-tab, or a chart, it will be displayed as a total.

42 © 2011 SAP AG. All rights reserved. 2011

Page 55: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Using the Report Design Environment

Formulas are needed to create and display values calculated in the report. Forexample, if the data source stores only the order dates and ship dates for orders, butyou need to display the number of days it takes to ship the order, you must create aformula that will calculate the number of days between ordering and shipping.

Parameters make your report more flexible. For example, in a report used bysalespeople, you might create a parameter that prompts the user to choose a region.When the user chooses a region, the report returns the results for the specific regioninstead of returning the results for all regions.

Report Design CanvasThe report design canvas is the area where you design the structure of your report.You can place various elements on the canvas including data objects, charts, andtext elements.

Two views are available for laying out the information and previewing it. One viewshows the structure only ("Structure" mode) and the other view is a page that includesdata ("Page" mode).

Working in Report Structure Mode"Structure" mode is where you do most of the initial work when creating a report. Itis where you do the initial formatting and place objects in the sections where youwant them to appear.

"Structure" mode provides an efficient environment for designing a report becauseyou work with data representations, not with data itself. When an object is placed onthe report, the program identifies the object but does not retrieve the data. The objectis represented by a frame.You can add and delete objects and other elements, movethem around, set up complex formulas, and more, without using the computer ornetwork resources needed to gather the data.

The report created in "Structure" mode contains only the structure and instructions forcreating the final report.

Working in Page ModeTo see how the report looks as a report with data, view it in "Page" mode.

"Page" mode shows the report structure and its data. In this mode you can see howyour report will look when it is printed or published.

"Page" mode allows you to edit the formatting of your report using the actual data.You can see the direct results of your changes on the report, allowing you to fine-tunethe formatting until the report looks exactly as you want it to.

2011 © 2011 SAP AG. All rights reserved. 43

Page 56: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 3: Creating a Report BOCE10

Lesson Summary

You should now be able to:• Use the report Design Enviroment• Place objects• Work with report structure and preview mode

44 © 2011 SAP AG. All rights reserved. 2011

Page 57: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Report Sections

Lesson: Report Sections

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Understand the relevance of sections• Get to know different sections

Business Example

Sections Overview (RH, PH, D, RF, PF)A report consists of several sections, including the "Report Header", "Page Header","Group Header", "Body", "Group Footer", "Page Footer", and "Report Footer". Thesesections are also called “Structure mode areas”

2011 © 2011 SAP AG. All rights reserved. 45

Page 58: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 3: Creating a Report BOCE10

Working with Sections (Structure mode areas)When you create a new report, Crystal Reports automatically creates five essentialreport areas in "Structure" mode:

• Report Header

This area is generally used for the report title and other information you want toappear at the beginning of the report. It can also be used for charts and cross-tabsthat include data for the entire report.

• Page Header

This area is generally used for information that you want to appear at the top ofeach page, such as chapter names, the name of the document, and other similarinformation. This area can also be used to display object titles above the objectson a report.

• Body

This area is used for the body of the report, and is printed once per record. Thebulk of the report data generally appears in this section.

• Report Footer

This area is used for information you want to appear only once at the end of thereport (such as grand totals) and for charts and cross-tabs that include data forthe entire report.

• Page Footer

This area usually contains the page number and any other information you wantto appear on the bottom of each page.

If a group is added to the report, the program creates two additional areas:

• Group Header

This area typically holds the group name object, and can be used to displaycharts or cross-tabs that include data specific to the group. It is printed onceat the beginning of a group.

• Group Footer

This area generally holds the summary value, if any, and can be used to displaycharts or cross-tabs. It is printed once at the end of a group.

When a group is added, the "Group Header" area appears directly above the "Body"area and the "Group Footer" area appears directly below the "Body" area.

46 © 2011 SAP AG. All rights reserved. 2011

Page 59: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Report Sections

If you set up additional groups, the program creates new group areas between the"Body" area and the existing "Group Header" and "Group Footer" areas.

2011 © 2011 SAP AG. All rights reserved. 47

Page 60: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 3: Creating a Report BOCE10

Lesson Summary

You should now be able to:• Understand the relevance of sections• Get to know different sections

48 © 2011 SAP AG. All rights reserved. 2011

Page 61: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Working with field objects

Lesson: Working with field objects

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Position, align and resize field objects

Business Example

Using the Data ExplorerUse the “Data Explorer” to insert, modify or delete field objects in your report.When you create a new report or open an existing report, the "Data Explorer" sidepanel opens adjacent to the report canvas. Objects that you add in the Query Panel arestored in the "Data Explorer" where they can be added to the report.

The "Data Explorer" side panel is separated into five areas. Expand the area byclicking the area name.

Result Objects

This area shows the parameters that have been created for the report. Right-click theside panel and click New to add a new parameter or a new cascading parameter group.

Formulas

This area shows the formulas that have been created for the report. Drag formulasto the report canvas to add them to the report. Right-click the side panel, and thenclick New Formula to add a new formula.

Parameters

This area shows the parameters that have been created for the report. Right-click theside panel and click New to add a new parameter or a new cascading parameter group.

Running Totals

This area shows the running totals that have been created for the report. Right-clickthe side panel and click New Running Total to add a new running total.

Predefined Objects

2011 © 2011 SAP AG. All rights reserved. 49

Page 62: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 3: Creating a Report BOCE10

This area shows the predefined objects you can add to your report. Drag objects to thereport canvas to add them to the report.

Using Smart GuidelinesSmart guidelines help you format report columns in the Crystal Reports designercanvas. The columns and the objects within them can be moved and rearrangedsimultaneously as the smart guideline calculate associated objects based upon similaralignment. The grids that appear on the report depend on the element you haveselected and the feature automatically selects related elements in the column.

The smart guidelines feature can be turned off in the "Report Options" dialog box. Todeactivate the feature without turning it off, press Alt.

Note: Smart guidelines do not work with elements that are already formated,such as cross-tab elements.

To insert a column using smart guidelinesSmart guidelines allow you to insert new result object columns without having tomanually move the surrounding columns over. If smart guidelines are disabled, theinserted result object will overlap the existing result object.

1. Select a result object from the "Data Explorer" side panel and drag the object tothe report canvas.

2. Align the result object frame in the desired column until the smart guidelinegrids appear to indicate the column position and place the result object.

Note: If you insert a column between two existing columns, the blue smartguideline grid will become a dark blue to indicate the column will bepositioned between the existing columns.

Adjusting columns using smart guidelinesYou can reorder, remove, and resize columns using the column side cursors andhandles on the top of the report canvas. Smart guidelines allow you to delete andadjust columns without having to manually move the surrounding columns over.

To adjust column width

1. Click the column you want to adjust. Smart guideline grids appear.2. You can reorder, remove, and resize columns using the column side cursors and

handles on the top of the report canvas. Smart guidelines allow you to delete andadjust columns without having to manually move the surrounding columns over.

3. Click and drag the column width to decrease or increase the size.

50 © 2011 SAP AG. All rights reserved. 2011

Page 63: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Working with field objects

To adjust column position

You can move a single column horizontally on the report canvas or multiple columnssimultaneously.

1. Click a column you want to move. Smart guideline grids appear.2. Click the column handles on top of the report canvas and drag the column:

• To move a single column, drag the column to the left or right. Smartguidelines will adjust the existing columns to accommodate there-positioned column.

• To move multiple columns, use a single column to push the existingcolumns over, or use the left side edge to drag a row of columns.

To swap columns using smart guidelines

1. Double-click the column you want to swap to select it. Smart guideline gridsappear.

2. Select the column handles on the top of the report canvas and drag the columnto overlap the column you want to swap and click to place the column. Thecolumn positions are swapped.

To create subcolumns using smart guidelinesYou can create a subcolumn by using a spanning header element such as a box or textelement that spans two or more columns.

1. Double-click a column you want to become a subcolumn. Smart guidelinegrids appear.

2. Click Insert > Box or Insert > Text.3. Place the element on the report canvas and drag the element frame to span two

or more columns you want joined. The spanning header element becomes asingle column containing subcolumns.

The subcolumns can be rearranged as a single column using the handles for thespanning header column.

2011 © 2011 SAP AG. All rights reserved. 51

Page 64: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 3: Creating a Report BOCE10

Lesson Summary

You should now be able to:• Position, align and resize field objects

52 © 2011 SAP AG. All rights reserved. 2011

Page 65: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Save a report

Lesson: Save a report

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Save a report as local file or save to an Enterprise folder

Business Example

Save a report as a local file1. The process for saving a report to your local computer is different if you are

logged into SAP BusinessObjects BI platform.

• If you are not logged in to SAP BusinessObjects BI platform, click File> Save.

• If you are logged in to SAP BusinessObjects BI platform, click File >Save as a local file.

2. In the "Save as" dialog box, browse for the location you want to save yourreport to.

3. Enter a name for your report (.rpt) file.4. Click Save.

The report is saved to the location you selected.

Note: Click File > Save as to save a report with a new name.

To save a report with no data

You may want to save a report without data if you want to re-use the report designwith different data.

1. Click File.2. Clear the Save Data With Report option.

The data will not be saved with the report when you save it to a file system or publishit to an SAP BusinessObjects BI platform server.

2011 © 2011 SAP AG. All rights reserved. 53

Page 66: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 3: Creating a Report BOCE10

Save a report to an Enterprise folderOne way to distribute your reports is through SAP BusinessObjects BI platform.When you publish a report to SAP BusinessObjects BI platform, you can deliver it toend users via any web application—intranet, extranet, Internet or corporate portal.

First you have to connect to an SAP Business Objects Enterprise Server.

1. If you are not already logged on to SAP BusinessObjects BI platform, clickFile > Log On to SAP BusinessObjects BI platform, enter your connectioninformation, and then click OK.

2. Click File > Save3. In the "Save Report to [Server Name]" dialog box, navigate to the location that

you want to save your report to.

Note: In these steps, [Server Name] represents the name of your SAPBusinessObjects BI platform server.

4. Type a display name in the Display Name box.5. Click Save

A dialog box appears with a message that your report has been successfully publishedto SAP BusinessObjects BI platform.

54 © 2011 SAP AG. All rights reserved. 2011

Page 67: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Save a report

Exercise 2: Creating a report

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task 1: Create a new reportYou will create a new report with Crystal Reports for Enterprise.

1. Start a new report as a blank report.

2. Logon to SAP Business Objects Enterprise (if not already done).

3. Choose the Xtremeplus_cr universe as your data source.

4. Use the following objects as result objects in your query:

Customer Name, City, Region, Order Amount, Order ID, Order Date

Task 2: Preview the reportPreview the report in Page mode and change the magnification of the report.

1. Preview the report.

2. Change the magnification in Page Mode.

Task 3: Save the reportAdd summary information to your report and save it to an SAP BusinessObjectsBI platform folder.

1. Add summary information to your report.

2. Save the report as Creating a report.

Note: Save all activity reports to the SAP BusinessObjects BI platformFolder My Favorites.

2011 © 2011 SAP AG. All rights reserved. 55

Page 68: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 3: Creating a Report BOCE10

Solution 2: Creating a reportTask 1: Create a new reportYou will create a new report with Crystal Reports for Enterprise.

1. Start a new report as a blank report.

a) Start -> Programs -> Crystal Reports for Enterprise

b) From the Start Page click Blank report.

2. Logon to SAP Business Objects Enterprise (if not already done).

a) Logon to SAP Business Objects Enterprise by choosing a ServerConnection and enter your user name and password.

3. Choose the Xtremeplus_cr universe as your data source.

a) In the “New Data Source Connection” dialog select the Data source typeUniverse.

b) Navigate the folders: Universes -> RKT Universes -> Xtreme and select"xtremeplus_cr.unx" universe and click Next.

4. Use the following objects as result objects in your query:

Customer Name, City, Region, Order Amount, Order ID, Order Date

a) On the left side of the Edit Query Panel open the Customer Folder byclicking on the plus sign in front of it.

b) Select the following objects from the Customer and Orders folders bypulling them over with the mouse or by double-clicking them.

Task 2: Preview the reportPreview the report in Page mode and change the magnification of the report.

1. Preview the report.

a) After selecting objects for the Result objects area of the Query Panel runthe Query by clicking Finsh.

b) The report will be displayed in Page mode.

Continued on next page

56 © 2011 SAP AG. All rights reserved. 2011

Page 69: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Save a report

2. Change the magnification in Page Mode.

a) Adjust the slider on the bottom right corner of the screen to the left to zoomout, and to the right to zoom in.

Note: You can also edit the zoom percentage manually by enteringa percentage into the text box.

Task 3: Save the reportAdd summary information to your report and save it to an SAP BusinessObjectsBI platform folder.

1. Add summary information to your report.

a) From the top menu click File -> Summary Info

b) Enter a title and a creators name.

c) Click OK and look at your report in Page Mode to see which of the enteredinformation is displayed.

2. Save the report as Creating a report.

Note: Save all activity reports to the SAP BusinessObjects BI platformFolder My Favorites.

a) From the top menu click File -> Save.

b) In the “Save Report to [Servername]” dialog box, navigate: All Folders ->My Folders -> My Favorites"

c) On the left bottom part of the dialog enter the Name Creating a reportand Click Save.

The report is now stored in your My Favorites.

2011 © 2011 SAP AG. All rights reserved. 57

Page 70: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 3: Creating a Report BOCE10

Lesson Summary

You should now be able to:• Save a report as local file or save to an Enterprise folder

58 © 2011 SAP AG. All rights reserved. 2011

Page 71: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Unit Summary

Unit SummaryYou should now be able to:• Connect to a Data Source• Create a query to retrieve data from the data source• Choose Result Objects• Use the report Design Enviroment• Place objects• Work with report structure and preview mode• Understand the relevance of sections• Get to know different sections• Position, align and resize field objects• Save a report as local file or save to an Enterprise folder

2011 © 2011 SAP AG. All rights reserved. 59

Page 72: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

60 © 2011 SAP AG. All rights reserved. 2011

Page 73: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Test Your Knowledge

Test Your Knowledge

2011 © 2011 SAP AG. All rights reserved. 61

Page 74: BOCE10 - Crystal Reports - Fundamentals of Report Design

Test Your Knowledge BOCE10

Answers

62 © 2011 SAP AG. All rights reserved. 2011

Page 75: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 76: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 77: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

63 © 2011 SAP AG. All rights reserved. 2011

Page 78: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

64 © 2011 SAP AG. All rights reserved. 2011

Page 79: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 4Report Layout and Formatting

Unit Overview[Enter a brief overview of the unit.]

Unit ObjectivesAfter completing this unit, you will be able to:

• Learn how to define Page properties• Get to know available report formatting options and how to define them

Unit ContentsLesson: Setting Page properties.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66Lesson: Formatting options... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

Exercise 3: Positioning and Formatting Objects .. . . . . . . . . . . . . . . . . . . . . . . . . . . 71

2011 © 2011 SAP AG. All rights reserved. 65

Page 80: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 4: Report Layout and Formatting BOCE10

Lesson: Setting Page properties

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Learn how to define Page properties

Business Example

Setting page size and page orientationCrystal Reports allows you to view and print your reports in a variety of page sizesusing either portrait or landscape orientation.

To set page size and page orientation

1. Click File > Page Setup. The "Page Setup" dialog box appears.2. Use the "Paper Size" menu to select a page size.3. Use the "Orientation" options to set the page orientation.4. Click OK.

Setting page marginsCrystal Reports allows you to change page margins to meet your specifications.

66 © 2011 SAP AG. All rights reserved. 2011

Page 81: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Setting Page properties

To set page margins

1. Click File > Page Setup. The "Page Setup" dialog box appears.2. Set the page "Margins" to fit your needs.3. Click OK.

Note:

• All margins are calculated from the paper edge. Thus, a left margin of .25 inchescauses the printing to start exactly one quarter inch in from the edge of the paper.

• Select Adjust Margins Automatically if you want Crystal Reports to adjust thereport's margins automatically the next time you change the page size. If youchoose a new page size that is large enough for the current printable area, CrystalReports increases or decreases the margins by enlarging or reducing the left/rightand top/bottom margins by the same factor. If you choose a new Report Layoutand Formatting page size that is smaller than the current printable area, CrystalReports fills the entire page by reducing the margins to 0. If you next choose abigger page, this (reduced) printable area is kept and the left/right, top/bottommargin ratios become 1:1.

• Page margins can also be controlled by use of conditional formulas.

Setting custom page sizeIf you are designing a report for the web, you may want to set a page size that doesnot correspond with standard printing paper sizes. Crystal Reports allows you to seta custom page size using the "Page Setup" dialog box.

To set custom page size

1. Click File > Page Setup. The "Page Setup" dialog box appears.2. On the "Paper Size" menu, click Custom.3. Adjust the width and height of the page by entering new values in the appropriate

text boxes.4. Click OK.

2011 © 2011 SAP AG. All rights reserved. 67

Page 82: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 4: Report Layout and Formatting BOCE10

Lesson Summary

You should now be able to:• Learn how to define Page properties

68 © 2011 SAP AG. All rights reserved. 2011

Page 83: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting options

Lesson: Formatting options

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Get to know available report formatting options and how to define them

Business Example

Formatting dataAfter building the structure of your report you may want to do some basic formatting.Perhaps you would like to change the font size and style of a text element used as atitle. Or, if you have a number element, such as a sales figure, you might want to placea dollar sign before the number or change the number of decimal places displayed.

To format elements using the Format dialog boxAt this point in creating a report, you may want to do some basic formatting. Perhapsyou would like to change the font size and style of a text element used as a title. Or, ifyou have a number element, such as a sales figure, you might want to place a dollarsign before the number or change the number of decimal places displayed.

Hint: You can also format elements through the “Format” tab in the tab bar,or by clicking Format on the standard toolbar.

Using the Format PainterOnce you have built the structure of your report, you may want to do some basicformatting. Perhaps you would like to change the font size and style of a text elementused as a title. Or, if you have a number element, such as a sales figure, you mightwant to place a dollar sign before the number or change the number of decimalplaces displayed.

2011 © 2011 SAP AG. All rights reserved. 69

Page 84: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 4: Report Layout and Formatting BOCE10

Use the Format Painter to copy common absolute and conditional formattingproperties from one report element to one or more target elements. The Format Painteroption is available when you right-click a source element in your report and chooseFormat Painter from the context menu. If you apply for formatting to a target objectthat is not the same as your source object, only the common properties are applied.For example, if your source object is a Boolean object, only the common propertiesare applied. For example, if your source object is a Boolean and your target object is acurrency object, only the common font and border properties are changed, Booleanproperties are not applied and currency properties are not set.

Note:

• The Format Painter does not copy hyperlink information to a targetelement or object.

• When using a “Date and Time” object as your source, a target object'sdate or time properties are changed; the reverse is also true (that is, aDate object or a Time object used as your source also affects the dateand time properties of a “Date and Time ” object).

To copy and apply formatting1. Select a source element or object in your report, right-click it, an choose Format

Painter.Note: Press ESC to exit the Format Painter.

2. Click the target element or object you want to apply formatting to.

When you move your mouse over your report, the cursor changes to a Stop cursor ifthe element or object cannot be used as a target.

Note: Hold the Alt key down if you want to apply formatting to more thatone element or object.

70 © 2011 SAP AG. All rights reserved. 2011

Page 85: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting options

Exercise 3: Positioning and FormattingObjects

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task 1: Rearrange and Resize ColumnsRearrange the columns in this order, from left to right: Region, City, Customer Name,Order date, Order Amount and Order ID.

1. Open the Creating a report report.

Task 2: Format the FieldsFormat the fields and column headings to properly display the data.

1. Resize the columns if necessary.

2. Format the currency object Order Amount with no decimals and no currencysymbol.

Note: You may need to turn off smart guidelines to do adjustments.

3. Format the text object Region and its column heading to be centered.

4. Format the DateTime object Order Date to print with no time portion.

5. Change the color of all column headings to print bold and in blue.

6. Create a text that will print “Customer & Orders Report” as the title in theReport Header.

7. Format the report title text element.

8. Save the report as Positioning and Formatting Objects.

2011 © 2011 SAP AG. All rights reserved. 71

Page 86: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 4: Report Layout and Formatting BOCE10

Solution 3: Positioning and FormattingObjectsTask 1: Rearrange and Resize ColumnsRearrange the columns in this order, from left to right: Region, City, Customer Name,Order date, Order Amount and Order ID.

1. Open the Creating a report report.

a) In the top menu click on File -> Open from [Servername].

b) Navigate to theMy Favorites Folder on the left side of the dialog and clickon it. On the right side of the dialog mark the report Creating a report andclick on Open.

Note: Alternatively double-click the filename.

The report Creating a Report opens in Page mode.

c) Click the Region field in the Body section so that the smart guidelinesappear.

d) Select the column handle on top of the report canvas and drag the Regioncolumn to overlap the Customer Name column.

The Region Column will be inserted on the left side of the Customer Namecolumn.

e) Continue rearranging the columns to their correct positions.

Task 2: Format the FieldsFormat the fields and column headings to properly display the data.

1. Resize the columns if necessary.

a) Resize the columns by pulling or pushing it on the right side of the columnhandle.

Hint: Select multiple fields to resize. Then right-click and choosesize -> same width from the resulting context menu.

Note: You may want to be in Page mode to see these options takeeffect.

Continued on next page

72 © 2011 SAP AG. All rights reserved. 2011

Page 87: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting options

2. Format the currency object Order Amount with no decimals and no currencysymbol.

Note: You may need to turn off smart guidelines to do adjustments.

a) Select the object Order Amount.

b) On the Format tab click on the currency icon.

c) On the Format tab click twice on the Decrease decimals icon.

3. Format the text object Region and its column heading to be centered.

a) Press the CTRL key and select both the Region object and its label.

b) On the Format tab click on the Align center Icon.

4. Format the DateTime object Order Date to print with no time portion.

a) Right-click the Order Date object.

b) Click on “Format Result Object Element” in the context menu.

c) Select Format on the left side.

d) On the right side choose a format with no time portion (like 04/01/2006).

e) Click Close.

5. Change the color of all column headings to print bold and in blue.

a) Press the CTRL key and select all column headings.

b) On the Format tab click on the Bold Symbol.

c) On the Format tab click on the black arrow next to the Font Color Symboland choose blue.

6. Create a text that will print “Customer & Orders Report” as the title in theReport Header.

a) On the Insert tab click on the text element icon.

b) In the report, drag and drop the box on the report page to the desiredlocation and size.

c) Type Customers & Orders Report.

Note: Double-click the box to change the text."

Continued on next page

2011 © 2011 SAP AG. All rights reserved. 73

Page 88: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 4: Report Layout and Formatting BOCE10

7. Format the report title text element.

a) Right click the text element and select the following formatting options inthe formatting dialog:

Folder Option Selection

Font - Alignment HorizontalAlignment

Centered

Font - Size Size 20

Font - Color Color Blue

Appearance -Border

Line Style (Left,Right, Top,Bottom)

Single

Appearance - DropShadow

Drop Shadow check box selected

b) Click Close.

8. Save the report as Positioning and Formatting Objects.

a) Click on File -> Save as on top of the canvas.

b) In the following dialog navigate to your My Favorites.

c) Enter the report name Positioning and Formatting Objects at the bottomof the dialog.

d) Click Save.

74 © 2011 SAP AG. All rights reserved. 2011

Page 89: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting options

Lesson Summary

You should now be able to:• Get to know available report formatting options and how to define them

2011 © 2011 SAP AG. All rights reserved. 75

Page 90: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

Unit SummaryYou should now be able to:• Learn how to define Page properties• Get to know available report formatting options and how to define them

76 © 2011 SAP AG. All rights reserved. 2011

Page 91: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Test Your Knowledge

Test Your Knowledge

2011 © 2011 SAP AG. All rights reserved. 77

Page 92: BOCE10 - Crystal Reports - Fundamentals of Report Design

Test Your Knowledge BOCE10

Answers

78 © 2011 SAP AG. All rights reserved. 2011

Page 93: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 94: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 95: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

79 © 2011 SAP AG. All rights reserved. 2011

Page 96: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

80 © 2011 SAP AG. All rights reserved. 2011

Page 97: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5Selecting Data

Unit Overview[Enter a brief overview of the unit.]

Unit ObjectivesAfter completing this unit, you will be able to:

• Edit a query• Define sorting within a query• Set a filter within a query• Learn how to insert additional filter conditions• Modify the query filter• Apply time based filters

Unit ContentsLesson: Editing a query .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

Exercise 4: Applying a query filter.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85Lesson: Inserting additional filter conditions ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

Exercise 5: Inserting an additional filter condition... . . . . . . . . . . . . . . . . . . . . . . . . 91Lesson: Modifying query filters .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

Exercise 6: Modifying the query filter .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97Lesson: Applying time based filters .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101

Exercise 7: Inserting a time based query filter.. . . . . . . . . . . . . . . . . . . . . . . . . . . . .103

2011 © 2011 SAP AG. All rights reserved. 81

Page 98: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5: Selecting Data BOCE10

Lesson: Editing a query

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Edit a query• Define sorting within a query• Set a filter within a query

Business Example

Editing an existing queryYou can return to the "Query Panel" to edit an existing query. Queries can be editedby adding or removing an object, or you can add, edit, or remove a filter.

To edit an existing query

Before the query can be edited, you must first log on to an SAP BusinessObjectsBI platform server.

1. To edit your report query, click Data > Edit Query. The "Query Panel" appears.2. In the "Query Panel", edit your query as necessary.3. When you have finished editing your query, click Finish.

Changes that you made in your query are reflected in your report.

Note: If you remove objects from your query that you have used in yourreport, the objects will automatically be removed from the report.

Define sorting within a queryThe sort button in the "Query Panel" will define how the data is retrieved from thedata source. When the query is run, a sort defined in the "Query Panel" will affect theorder and amount of data that is retrieved from the data source.

You can sort locally, using Crystal Reports features which sorts all the data retrievedfrom the query. Using the sorting option in the "Query Panel" is recommended todefine your sort more efficiently since it sorts the data from the data source.

82 © 2011 SAP AG. All rights reserved. 2011

Page 99: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Editing a query

Create a filter within a queryYou can add filters and prompts to your query to limit the data shown in the report.

Note: Filters and member selection allow you to sort your data in differentways. Member selection does not have an effect on the measure value of yourdata. For example, if you select a single city or all the cities for a country, thevalue for the measure for that country will not be affected by the memberselection. Filtering data does have an effect on the measure value. Forexample, if you filter your data for a particular city, the value for the relatedcountry will be reduced to the value of that country.

You can use the following types of filters in a query:

• Predefined filters

These filters are created by your administrator.

• Custom filters

You define these filters while you are creating the query.

• Prompts

Prompts are dynamic filters that you define to display a question or a list ofvalues; users can select different filter values each time they refresh the report.

To add a predefined filter to a query

1. Double-click the objects you want to use in your report, or drag them to the“Result Objects” pane.

2. Drag a predefined filter to the “Filters” pane.

Note: Predefined filters are created and edited by your administrator. As auser of the "Query Panel", you cannot view the component parts of predefinedfilters, neither can you edit them.

When you run the query, the data corresponding to the query filters you selectedis returned to the report.

To create a custom filter

1. Select the object you want to filter and drag it to the "Filters" pane.2. Select an operator from the list.3. Select Constant, LOV (list of values), or Prompt.4. The value you enter depends on the option you selected in step 3:

2011 © 2011 SAP AG. All rights reserved. 83

Page 100: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5: Selecting Data BOCE10

Option Description

Constant• Type a value into the text box

LOV1. In the "Prompt(s)" dialog box, add members to your list

by double-clicking them, or by selecting them in the"Members" pane and clicking the arrow in the center.

2. Click OK

Prompt1. In the "Edit Prompt" dialog box, select "New Prompt" to

add a new prompt, or "Use Universe Parameters" to selecta parameter from your universe.

2. If you selected a "New Prompt", enter prompt options,or if you selected "Use Universe Parameters", select aparameter.

3. Click OK.

The filter is added to the report. You can edit or remove the filter in the “Query Panel.”

84 © 2011 SAP AG. All rights reserved. 2011

Page 101: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Editing a query

Exercise 4: Applying a query filter

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Applying a query filterApply a query filter to show only customers from the following regions: BritishColumbia (BC), Ohio (OH), Pennsylvania (PA) and California (CA).

1. Open the Positioning and formatting objects report.

2. Create a query filter within the query panel.

3. Save your report as Applying a query filter.

2011 © 2011 SAP AG. All rights reserved. 85

Page 102: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5: Selecting Data BOCE10

Solution 4: Applying a query filterTask: Applying a query filterApply a query filter to show only customers from the following regions: BritishColumbia (BC), Ohio (OH), Pennsylvania (PA) and California (CA).

1. Open the Positioning and formatting objects report.

a) Logon to SAP BusinessObjects BI platform if not already done.

b) In the top menu click on File -> Open from [servername] .

c) In the following dialog navigate to the My Favorites folder.

d) Mark the Positioning and formatting objects report.

e) Click Open.

2. Create a query filter within the query panel.

a) On the Data tab click on “Edit query” .

b) Drag the Region object from the result area to the filters area of the querypanel.

Note: Alternatively you can pull the Region object from theCustomer folder on the left side to the filters area.

c) From the list of available operators choose the In List operator.

d) From the list of available value types choose LOV (List of Values).

e) In the Select value dialog mark the elements BC, OH, PA and CA on theleft side and click on the > button to move them over to the right side.

Note: Alternatively you can enter them as single values on top ofthe list of elements and click them over to the right a side withthe > button.

f) Click OK on the bottom of the Select dialog.

g) Click OK on the bottom of the Query panel.

Continued on next page

86 © 2011 SAP AG. All rights reserved. 2011

Page 103: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Editing a query

3. Save your report as Applying a query filter.

a) In the top menu click on File -> Save As ...

b) In the following dialog navigate to yourMy Favorites SAP BusinessObjectsBI platform folder.

c) Save the report as Applying a query filter.

ResultThe report shows only customer records from the specified regions.

2011 © 2011 SAP AG. All rights reserved. 87

Page 104: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5: Selecting Data BOCE10

Lesson Summary

You should now be able to:• Edit a query• Define sorting within a query• Set a filter within a query

88 © 2011 SAP AG. All rights reserved. 2011

Page 105: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Inserting additional filter conditions

Lesson: Inserting additional filter conditions

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Learn how to insert additional filter conditions

Business Example

Inserting an additional filter conditionIn order to refine your data selection it might be necessary to add additional filterconditions to your query.

By default, the “Query Panel” combines the filters (and prompts) with the ANDOperator.

For example the filter condition [Country Equal to Germany] and a additionalcondition [State equal to California] would be logically combined with an AND whenyou create both conditions in the “Filters” pane of the “Query Panel”.

Note: If necessary you can change the AND Operator to an OR bydouble-clicking it.

Using AND or OR to combine query filters

Retrieve this data Example Select

Data true for both filters Customers who ordered suppliesin Q1 and in Q2 (the data youretrieve will include: customerswho placed orders in both Q1and Q2).

AND

Data true for any one of the filters Customers who ordered suppliesin: Q1 or Q2 (the data youretrieve will include: customerswho placed orders in Q1only;

OR

2011 © 2011 SAP AG. All rights reserved. 89

Page 106: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5: Selecting Data BOCE10

customers who placed ordersonly in Q2, and; customers whoplaced orders in both Q1 andQ2).

90 © 2011 SAP AG. All rights reserved. 2011

Page 107: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Inserting additional filter conditions

Exercise 5: Inserting an additional filtercondition

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task 1: Insert an additional filter condition in the existingquery.Insert an additional filter condition that includes only records in your report with anorder amount over $1000.

1. Open the report Applying a query filter.

2. Insert an additional filter condition into the existing query.

3. Save your report as Inserting an additional filter condition.

2011 © 2011 SAP AG. All rights reserved. 91

Page 108: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5: Selecting Data BOCE10

Solution 5: Inserting an additional filterconditionTask 1: Insert an additional filter condition in the existingquery.Insert an additional filter condition that includes only records in your report with anorder amount over $1000.

1. Open the report Applying a query filter.

a) Logon to SAP BusinessObjects BI platform if not already done.

b) In the top menu click on File -> Open from [servername] .

c) In the following dialog navigate to the My Favorites folder.

d) Mark the Applying a query filter report.

e) Click Open .

2. Insert an additional filter condition into the existing query.

a) On the Data tab click on “Edit query” . The Query panel opens.

b) Click on the plus-sign in front of the Orders folder on the left side.

c) Drag the Order Amount object from the Orders folder to the filters area ofthe query panel.

Note: The new filter will be logically combined with the existingfilter by the AND operator. This happens automatically but can bechanged if needed.

d) In the new filter that is related to the object Order Amount choose Greaterthan from the list of available operators.

e) In the value field enter 1000 as a constant value.

f) Click OK to run the query.

The report shows only customer records from the specified regions thatinclude an order amount over $1000.

3. Save your report as Inserting an additional filter condition.

a) Save your report as Inserting an additional filter condition in your MyFavorites.

92 © 2011 SAP AG. All rights reserved. 2011

Page 109: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Inserting additional filter conditions

Lesson Summary

You should now be able to:• Learn how to insert additional filter conditions

2011 © 2011 SAP AG. All rights reserved. 93

Page 110: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5: Selecting Data BOCE10

Lesson: Modifying query filters

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Modify the query filter

Business Example

Changing logical operators in filtersLogical Operators that combine filter conditions can be changed by double-clickingthem. An AND can be changed into an OR or an OR to an AND.

Removing filter conditions from a filterIn order to remove filter conditions you can mark them and press delete or click theremove Selected filters Icon.

In case you want to delete all filter conditions mark them all and press delete or clickthe Remove all filters Icon.

Changing and removing elements from a filter conditionIn order to change or remove elements from a filter condition it depends on whichkind of element it is.

In case it is an operator you can choose a different operator from the operators list.

In case it is a constant you can delete it or type in a different constant.

In case it is one or more elements from a LOV (List of Values) you need to open theSelect a value dialog and remove the element(s) or select a different one(s).

In case it is an object you have to remove it by clicking on the cross sign related tothe object or you have to replace it by moving a different object in the same place ofthe filter condition.

94 © 2011 SAP AG. All rights reserved. 2011

Page 111: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Modifying query filters

In case it is a prompt you edit the prompts properties or you can replace it by anelement of a different type (constant, LOV, object).

2011 © 2011 SAP AG. All rights reserved. 95

Page 112: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5: Selecting Data BOCE10

96 © 2011 SAP AG. All rights reserved. 2011

Page 113: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Modifying query filters

Exercise 6: Modifying the query filter

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Modifying the query filterModify the current record selection by specifying only BC and CA as the regionsto display. Switch between the selection criteria using “and” to “or” to change thestatement between the Order Amount and Region criteria. Notice the difference inthe report data.

1. Open the Inserting an additional filter condition report.

2. Specify only BC and CA as the regions to display in the current record selectionformula.

3. Change the AND operator between the Region and Order Amount filter to OR.Review the report and than switch the OR back to an AND.

4. Save the report asModifying the query filter.

2011 © 2011 SAP AG. All rights reserved. 97

Page 114: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5: Selecting Data BOCE10

Solution 6: Modifying the query filterTask: Modifying the query filterModify the current record selection by specifying only BC and CA as the regionsto display. Switch between the selection criteria using “and” to “or” to change thestatement between the Order Amount and Region criteria. Notice the difference inthe report data.

1. Open the Inserting an additional filter condition report.

a) Open the Inserting an additional filter condition report from your MyFavorites folder.

2. Specify only BC and CA as the regions to display in the current record selectionformula.

a) Specify only BC and CA as the regions selected in your query.

b) On the Data tab click on Edit Query.

c) In the Query panels filter area open the list of selected regions by clickingon the symbol beside the already selected elements.

d) Remove the regions OH and PA by marking them in the list of alreadyselected elements and clicking on the < button.

Note: You can remove a single region or remove several regionsat one time. To easily change the date, choose "constant", thenclick on the MONTH (choose the month), then click on the YEAR(choose the year), click on the TIME portion (change time)."

e) Click OK on the bottom of the Select dialog.

f) Click OK on the bottom of the Query panel.

Continued on next page

98 © 2011 SAP AG. All rights reserved. 2011

Page 115: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Modifying query filters

3. Change the AND operator between the Region and Order Amount filter to OR.Review the report and than switch the OR back to an AND.

a) On the Data tab click on Edit Query.

b) In the Query panels filter area double-click the AND Operator. It switchesto an OR.

c) Click OK on the bottom of the Query panel.

d) Take a look at your report in Page mode.

Note: The number of records displayed can be seen in the statusbar.

Notice that the report data displays all records with an Order Amountgreater than $1000, including customers from OH and PA regions.

e) On the Data tab click on Edit Query.

f) In the Query panels filter area double-click the OR Operator. It switchesto an AND.

g) Click OK on the bottom of the Query panel.

h) Take a look again at your report in Page mode.

Note: The number of records displayed can be seen in the statusbar.

Notice that the report data displays only customers from BC and CAregions with Order Amounts greater than $1000.

4. Save the report asModifying the query filter.

a) Save the report as Modifying the query filter to your My Favorites.

2011 © 2011 SAP AG. All rights reserved. 99

Page 116: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5: Selecting Data BOCE10

Lesson Summary

You should now be able to:• Modify the query filter

100 © 2011 SAP AG. All rights reserved. 2011

Page 117: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying time based filters

Lesson: Applying time based filters

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Apply time based filters

Business Example

Applying a time based filterWhen creating a time based filter you have different options depending on the objecttype you are working with in your query condition.

In case you are working with a constant you can use the calendar icon to choose a date.

In case you are working with a LOV (List of Values) you can use the calendar icon tochoose a date or alternatively take a value from a list.

In case you are working with a prompt you will be prompted when you run the queryand then you can choose a value from a list.

Note: Crystal Reports has three different data types that are date and timerelated:

1. Date2. Datetime3. Time

The Data type of an object can be made visible in the Data Explorer when you clickon the Data Explorer's Options Button.

2011 © 2011 SAP AG. All rights reserved. 101

Page 118: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5: Selecting Data BOCE10

102 © 2011 SAP AG. All rights reserved. 2011

Page 119: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying time based filters

Exercise 7: Inserting a time based queryfilter

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Inserting a query filter based on a time spanModify the exiting query to display customer and order data for the year 2001 only.

1. Open theModifying the query filter report.

2. Insert a query filter based on the year 2001.

3. Save the report as Inserting a time based query filter.

2011 © 2011 SAP AG. All rights reserved. 103

Page 120: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 5: Selecting Data BOCE10

Solution 7: Inserting a time based queryfilterTask: Inserting a query filter based on a time spanModify the exiting query to display customer and order data for the year 2001 only.

1. Open theModifying the query filter report.

a) Open the Modifying the query filter report from your My Favorites folder.

2. Insert a query filter based on the year 2001.

a) On the Data tab click Edit Query.

b) Open the Orders folder by clicking on the plus-sign in front of it and pullthe Order Date object into the filters area of the query panel.

Note: In order to avoid nesting the new filter condition into aexisting one you need to position the Order Date field in the filtersarea on the same level as the existing filters conditions.

c) From the list of available operators choose the operator Between .

d) As the start date choose “Jan 1, 2001” and as the end date “Dec 31, 2001”from the list.

Note: You can choose the date from the calender icon or from thelist of existing values (LOV). If you want to work with the listsorting makes it easier to look for a specific value. In order to sortuse the sorting icon in the Select value dialog.

e) Click OK at the bottom of the query panel.

The report now displays only records from 2001.

3. Save the report as Inserting a time based query filter.

a) Save the report as Inserting a time based query filter to yourMy Favorites.

104 © 2011 SAP AG. All rights reserved. 2011

Page 121: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying time based filters

Lesson Summary

You should now be able to:• Apply time based filters

2011 © 2011 SAP AG. All rights reserved. 105

Page 122: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

Unit SummaryYou should now be able to:• Edit a query• Define sorting within a query• Set a filter within a query• Learn how to insert additional filter conditions• Modify the query filter• Apply time based filters

106 © 2011 SAP AG. All rights reserved. 2011

Page 123: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Test Your Knowledge

Test Your Knowledge

2011 © 2011 SAP AG. All rights reserved. 107

Page 124: BOCE10 - Crystal Reports - Fundamentals of Report Design

Test Your Knowledge BOCE10

Answers

108 © 2011 SAP AG. All rights reserved. 2011

Page 125: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 126: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 127: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

109 © 2011 SAP AG. All rights reserved. 2011

Page 128: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

110 © 2011 SAP AG. All rights reserved. 2011

Page 129: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6Sorting, Grouping and Totalling

Unit Overview[Enter a brief overview of the unit.]

Unit ObjectivesAfter completing this unit, you will be able to:

• Sort Data• Create and modify groups• Create nested and multiple groups• Reorder groups• Add a custom group based on criteria not specified in the database• Group on time• Create subtotals• Total on column data

Unit ContentsLesson: Sorting Data ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

Exercise 8: Applying Sorting Options ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117Lesson: Grouping data ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .121

Exercise 9: Creating and modifying a group ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123Lesson: Create nested and multiple groups... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127

Exercise 10: Creating and reordering multiple groups ... . . . . . . . . . . . . . . . . .129Lesson: Create a custom group ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132Lesson: Group on time-based data... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135

Exercise 11: Grouping on a date field .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137Lesson: Total grouped data... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .140

Exercise 12: Inserting subtotals .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143Lesson: Total column data... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147

Exercise 13: Inserting grand totals .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .149

2011 © 2011 SAP AG. All rights reserved. 111

Page 130: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Lesson: Sorting Data

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Sort Data

Business Example

Understanding sort optionsWhen you first insert a result object into your report, the data within the objectsappears in an arbitrary order. However, you can use the Sorting feature to sort datainto a logical format.

When you sort, Crystal Reports asks you to define two things: the sort direction(ascending or descending), and the object you want the sort to be based on (sort object).

Sort objects let you determine the order in which data appears on your report.Almost any object can be used for sorting, including formulas. An object's data typedetermines how the data from that object is sorted.

Note: You cannot sort on memo or BLOB objects.

Object Type Sort Order

character string objects blankspunctuationnumbersuppercase letterlowercase letters

Currency objects numeric order

Number objecs numeric order

Date objects chronological order

112 © 2011 SAP AG. All rights reserved. 2011

Page 131: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Sorting Data

DateTime objects chronological order

Boolean comparison objects False values (0)True values (1)

Null values null valuesnon-null values

How to sort dataIn single object sorting, all the records used in the report are sorted based on the valuesin a single object. Sorting an inventory report by stock number or sorting a customerlist by customer number are examples of single object sorts.

In multiple object sorts, Crystal Reports first sorts the records based on the values inthe first object selected, putting them in ascending or descending order as specified. Iftwo or more records have a matching object value in the first sort object, the matchingrecords are sorted by the value in the second sort object.

For example, if you choose to sort first by Country and then by Region, both inascending order, the report would appear with countries listed in alphabetic order, andregions within each country listed in alphabetic order. Any other objects, such as thepostal codes within each region, would remain unsorted.

You create single or multiple object sorts using the same procedure.

To sort your data

1. On the "Data" tab, click Sorts. The "Groups and Sorts" dialog box appears.2. Expand the Body area, and click Add Sort.3. From the list, select the object you want to sort on.4. Click the Sort button to switch from ascending to descending sort order.5. Repeat steps 2 to 4 to add additional sort objects.

Note: The data is sorted in the order that the objects are listed. You can changethe order of multiple sort objects by moving them up or down in the list.

Sort ControlsYou may want to design your report so that users can modify a sort object or sortdirection without refreshing information from the data source. You can do this byusing a sort control.

2011 © 2011 SAP AG. All rights reserved. 113

Page 132: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

A sort control is useful for several reasons:

• It allows users to sort report data for further analysis without leaving the canvasof the report.

• It eliminates processing demand on the data source.• reduces the time spent waiting for data to be sorted.• It allows users to sort objects in the report with or without a connection or rights

to access the data source at the time of viewing.

When planning to include a sort control in your report, it is important to consider thefollowing points:

• Sort controls apply across an entire record set; you cannot sort only one group.• Sort controls cannot be used in subreports.• Sort controls cannot be created within a Cross-tab.

Note: There are two ways to insert a sort control on your report: you caninsert a sort control as a separate element on the report, or you can bind thesort control to an existing element.

To create a sort control

Before you create a sort control, you must create a sort object.

You can bind a sort control to an existing element in the "Page Header" sectionof the report canvas. For example, if you are creating a sort control on theCustomer.LastName sort object, you may want to bind the sort control to theCustomer.LastName object header. The sort control will then be applied to all dataretrieved by that object.

1. In the "Page Header" section, right-click the object that you want to bind the sortcontrol to, and then click Bind Sort Control.

The "Sort Control" pane appears. The "Sort Control" pane lists the sort objectsyou have added to the report.

2. From the list, select the sort object to which you want to bind a sort control,and then click OK.

3. Repeat these steps for any additional sort controls you want to add.

Hint: You can also insert a sort control as a separate element on your reportthrough the "Insert" tab. The sort control will not be bound to an element thatalready exists on the report, such as a group header.

An interactive sort control is added to the report.

114 © 2011 SAP AG. All rights reserved. 2011

Page 133: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Sorting Data

Users can sort the objects you have selected by clicking the sort arrows that appearbeside the element. The report promotes the selected object temporarily to the top ofthe sort order. When a second sort control is used, the first is returned to its originalposition in the sort order and the second is promoted to the top sort.

Note: Grouping hierarchy is not affected by sort controls.

To remove a sort control

A sort control can be removed only through the Bind Sort Control dialog box.

1. Right-click the text object that contains the existing sort control.2. Click Bind Sort Control. The Bind Sort Control dialog box appears.3. Click Not Interactive.4. Click OK.

The sort control is removed from the report.

2011 © 2011 SAP AG. All rights reserved. 115

Page 134: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

116 © 2011 SAP AG. All rights reserved. 2011

Page 135: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Sorting Data

Exercise 8: Applying Sorting Options

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task 1: Sort RecordsSort the report records to display in ascending order by Region and City, thendescending order by Order Date.

1. Open the Inserting a time based query filter report.

2. Sort the records of your report.

Task 2: Create Sort ControlsCreate a sort control of the existing text object, Region, in the page header.

1. Apply a sort control to the Region heading.

2. Save the report as Applying Sorting Options.

2011 © 2011 SAP AG. All rights reserved. 117

Page 136: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Solution 8: Applying Sorting OptionsTask 1: Sort RecordsSort the report records to display in ascending order by Region and City, thendescending order by Order Date.

1. Open the Inserting a time based query filter report.

a) Open the Inserting a time based query filter report from yourMy Favorites .

2. Sort the records of your report.

a) On the Data tab click Sorts.

b) On the Sorts tab of the following dialog expand Body.

c) Open the Add Sort list .

d) Add Region. Specify ascending as the sort direction using the Sort Icon.

e) Add City. Specify ascending as the sort direction using the Sort Icon.

f) Add Order Date. Specify descending as the sort direction using the SortIcon.

g) Make Region the first, City the second and Order date the third object inyour sorting order using the arrows on top of the dialog.

h) Click OK.

Continued on next page

118 © 2011 SAP AG. All rights reserved. 2011

Page 137: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Sorting Data

Task 2: Create Sort ControlsCreate a sort control of the existing text object, Region, in the page header.

1. Apply a sort control to the Region heading.

a) Right-click Region in the page header.

b) From the resulting menu click Bind Sort Control.

c) In the following dialog box choose Sort on: Region: ascending and clickOK

When you preview the report, notice how the Region heading now has upand down arrows to allow you to change the sort direction of the regiondata.

Note: In case the sorting arrows are cut off, enlarge the PageHeader of the report and increase the height of the Regions fieldheading.

2. Save the report as Applying Sorting Options.

a) Save the report as Applying Sorting Options to your My Favorites.

2011 © 2011 SAP AG. All rights reserved. 119

Page 138: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Lesson Summary

You should now be able to:• Sort Data

120 © 2011 SAP AG. All rights reserved. 2011

Page 139: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Grouping data

Lesson: Grouping data

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Create and modify groups

Business Example

Grouping dataGrouped data is data that is sorted and separated into meaningful groups. For example,a customer list may be grouped by Postal Code or Region. In a sales report, a groupmight consist of all orders placed by a particular customer or orders generated by aparticular sales representative.

Group and Sort direction

When data is grouped, the following sort and group direction options are available.Direction refers to the order in which the values are displayed:

1. Ascending

Ascending order means smallest to largest (1 to 9, A to Z, False to True). Theprogram sorts the records in ascending order and then begins a new groupwhenever the value changes.

2. Descending

Descending order means largest to smallest (9 to 1, Z to A, True to False). Theprogram sorts the records in descending order and then begins a new groupwhenever the value changes.

3. Specified Order

Specified order is an order that you customize for your needs. The programplaces each record into the custom group that you specify, leaving the recordsin each group in original order; or, it sorts them in ascending or descendingorder, depending on your instructions.

2011 © 2011 SAP AG. All rights reserved. 121

Page 140: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Creating a groupIn order to create a group do the following steps:

1. On the "Insert" tab, click Group. The "Group" pane opens.2. Select the object you want to group on.3. Select the sort order, Ascending or Descending, and then click Insert.

The group is inserted into the report at the first level. If you create more groupsin your report, you will need to specify the order in which they appear.

4. If you want to change the font size of the group name, resize it from the "Format"tab.

Modifying a groupIn order to modify a group do the following steps:

1. On the "Insert" tab, click Group. The "Group" pane opens.2. On the "Group" pane click on “Edit groups”3. The “Groups and Sorts” dialog windows opens.

Modify your existing groups as you want.

122 © 2011 SAP AG. All rights reserved. 2011

Page 141: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Grouping data

Exercise 9: Creating and modifying a group

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task 1: Create a groupModify the query filter of your report and create a group.

1. Open the Applying sorting options report.

2. Remove the filter criteria for records with Order Amount being greater that$1000.

3. Group the records on your report by City and set the group sort order to beascending in alphabetical order.

Task 2: Modify a groupModify the existing group to be based on a different object and remove a column.

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

2. Remove the Region column.

3. Save the report as Creating and Modifying a group.

2011 © 2011 SAP AG. All rights reserved. 123

Page 142: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Solution 9: Creating and modifying a groupTask 1: Create a groupModify the query filter of your report and create a group.

1. Open the Applying sorting options report.

a) Open the Applying sorting options report from your My Favorites.

2. Remove the filter criteria for records with Order Amount being greater that$1000.

a) On the Data tab click Edit query.

b) Select the Order Amount filter criteria in the filter area of the query panel.

c) Click on the Remove Selected Filters button.

d) On the bottom of the query panel click OK.

The report is shown in page mode.

3. Group the records on your report by City and set the group sort order to beascending in alphabetical order.

a) On the Data tab click on Groups.

b) In the Groups tab of the Groups and Sorts dialog, click on the New buttonand select city as the object the group shall be based on.

c) On the Sorts tab expand the group and make sure the City will be sorted inascending order.

Note: You can change the sort order by clicking on the Sort Iconand choosing a sort order from the list.

d) On the bottom of the Sorts and Groups dialog click OK.

e) View the report in Page Mode. Notice that the records have been groupedbased on City.

Continued on next page

124 © 2011 SAP AG. All rights reserved. 2011

Page 143: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Grouping data

Task 2: Modify a groupModify the existing group to be based on a different object and remove a column.

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

a) On the Data tab click on Groups.

b) In the Groups tab of the Groups and Sorts dialog select Region as theobject the group shall be based on.

c) On the Sorts tab, expand the group and make sure the Region will besorted in ascending order. Click OK.

d) View the report in Page Mode. Notice that the records have been groupedbased on Region.

2. Remove the Region column.

a) Select the Region column, right-click the column header and click Delete

3. Save the report as Creating and Modifying a group.

a) Save the report as Creating and Modifying a group to your My Favorites.

2011 © 2011 SAP AG. All rights reserved. 125

Page 144: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Lesson Summary

You should now be able to:• Create and modify groups

126 © 2011 SAP AG. All rights reserved. 2011

Page 145: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Create nested and multiple groups

Lesson: Create nested and multiple groups

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Create nested and multiple groups• Reorder groups

Business Example

Creating nested and multiple groupsYou can structure your report by creating groups on several levels. A group thatfollows another group is nested within another group.

If you want to create several groups do the following steps:

1. On the "Insert" tab, click Group. The "Group" pane opens.2. Click on the New Button on the“Groups” tab to define a new group.3. Select the sort order, Ascending or Descending if necessary.4. Repeat step 1. to 3. for every group you want to create.5. Click OK

Reordering groupsOnce you have created several new groups and the group order does not fulfill yourpurpose you might need to reorder the groups.

If you want to change the order of the groups do the following steps:

1. On the "Insert" tab, click Group. The "Group" pane opens.2. Click on “Edit Groups”.3. On the “Groups” tab mark the group you want to move up or down.4. Click the UP- or Down-Arrow to move the group.

2011 © 2011 SAP AG. All rights reserved. 127

Page 146: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

128 © 2011 SAP AG. All rights reserved. 2011

Page 147: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Create nested and multiple groups

Exercise 10: Creating and reorderingmultiple groups

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task 1: Create a new groupCreate a new group in your report.

1. Create a new group based on Country in ascending order.

Task 2: Reorder multiple groupsReorder the existing groups in your report.

1. Reorder the existing groups so that the Country group is on top.

2. Save the report as Creating and reordering multiple groups.

2011 © 2011 SAP AG. All rights reserved. 129

Page 148: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Solution 10: Creating and reorderingmultiple groupsTask 1: Create a new groupCreate a new group in your report.

1. Create a new group based on Country in ascending order.

a) On the Data tab click Groups.

b) In the Groups and Sorts dialog click on the New button and select theCountry object from the list.

Note: In case the Country object is not available you need to add itas an result object in the query panel first and then return again tothe Groups and Sorts dialog. The Country object can be found inthe Customer folder on the left side of the query panel.

Task 2: Reorder multiple groupsReorder the existing groups in your report.

1. Reorder the existing groups so that the Country group is on top.

a) Select the Country group within the Groups and Sorts dialog and click theUp arrow to move the Country group above the Regions group.

b) On the bottom of the Groups and Sorts dialog click OK.

2. Save the report as Creating and reordering multiple groups.

a) Save the report as Creating and reordering multiple groups to your MyFavorites.

130 © 2011 SAP AG. All rights reserved. 2011

Page 149: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Create nested and multiple groups

Lesson Summary

You should now be able to:• Create nested and multiple groups• Reorder groups

2011 © 2011 SAP AG. All rights reserved. 131

Page 150: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Lesson: Create a custom group

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Add a custom group based on criteria not specified in the database

Business Example

Creating a custom groupUsually data is sorted and grouped based on the values from an object in the report.Sometimes, however, you may want to group data based on other criteria. Customgroups provide a solution for grouping data in such instances. For example:

• You want to create collections of groups based on the values in an object.

For example, you may have a Color object on your report that includes specificcolor names (Logan Green, Sky Blue, Emerald Green, Navy Blue, and so on) butyou want all shades of each color to appear as a single group (Greens, Blues,Reds, and so on). In this case you can build custom groups and manually assignthe records you want to be in each group.

• You want to select specific values or ranges of values for each group.

For example, you might want one group to contain records where gross salesare less than a certain value, a second group where gross sales are greater than acertain value, and a final group where gross sales fall between two values. In thiscase, you can create custom groups (Low Sales, Medium Sales, High Sales) thatuse the same range of selection facilities that are available to you for buildingrecord selection queries.

Creating custom groups to perform specified order grouping provides a solution tothese sorting and grouping challenges. Specified order grouping enables you to createboth the customized groups that will appear on a report and the records that each groupwill contain. The only limitation is that a record can be assigned to only one group.

132 © 2011 SAP AG. All rights reserved. 2011

Page 151: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Create a custom group

To create a custom group

Note: Before you create a custom group, you must create a group in yourreport.

1. Click Data > Groups. The "Groups and Sorts" dialog box appears.2. On the “Group” dialog box click on “Edit Groups.”3. Click the Custom Grouping button adjacent to the group name. The "Custom

Grouping" dialog box appears.4. In the "Custom Sort" area, click the first cell and type a name for the custom

group..5. To edit the condition used to filter data for the group, click the "Condition"

cell adjacent to the "Custom Sort" cell, and set the filter condition in the "NewCustom Grouping" dialog box.

Note: When you use the InList operator in your condition you canassign several elements to one custom group.

6. After you have created all of the custom groups needed for the report, select anoption for organizing the records that are not in one of the custom groups:

• Discard everything else• Group everything else in a single group with the name: <Others>• Include everything else without changing the grouping.

2011 © 2011 SAP AG. All rights reserved. 133

Page 152: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Lesson Summary

You should now be able to:• Add a custom group based on criteria not specified in the database

134 © 2011 SAP AG. All rights reserved. 2011

Page 153: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Group on time-based data

Lesson: Group on time-based data

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Group on time

Business Example

Grouping on time-based dataCompared with grouping on other field types grouping on time-based data has apeculiarity. You can subdivide the time-based groups by intervals like day, month,year. This option has a significant influence on the results displayed on a report.

In order to create a time-based group with a specified time-interval do the followingsteps:

1. On the “Insert” tab, click Group. The “Group” pane opens.2. Click on the New Button on the “Groups” tab to define a new group.3. Choose a data or data-time field from the list of available fields.4. Expand the group dialog box by clicking on the expand symbol.5. Choose an interval from the subdivided by list.6. Click OK.

2011 © 2011 SAP AG. All rights reserved. 135

Page 154: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

136 © 2011 SAP AG. All rights reserved. 2011

Page 155: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Group on time-based data

Exercise 11: Grouping on a date field

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Group by Order DateGroup the report records based on Order Date and format the group name.

1. Open the Creating and reordering multiple groups report.

2. Insert a group based on Order Date.

3. Format the group name to display the month in words and the year as a number.

4. Save the report as Grouping on a date object.

2011 © 2011 SAP AG. All rights reserved. 137

Page 156: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Solution 11: Grouping on a date fieldTask: Group by Order DateGroup the report records based on Order Date and format the group name.

1. Open the Creating and reordering multiple groups report.

a) Open the report Creating and reordering multiple groups from your MyFavorites.

2. Insert a group based on Order Date.

a) On the Data tab click on Groups.

b) Click on the New button and choose the Order Date object from the list.

c) Expand the Order Date group and choose for Subdivide by: “Each Month”.

d) Click OK.

3. Format the group name to display the month in words and the year as a number.

a) Right-Click the Group name of the Order Date object and choose FormatGroup Name Element ...

b) In the Group Name dialog open the format folder on the left side and clickon Date.

c) For the month select “March”, for the year select “1999” and for SeparatorFirst: change the "/" to a [Space].

Note: The selected month and year are only samples to demonstratethe format.

d) Click Close.

4. Save the report as Grouping on a date object.

a) Save the report as Grouping on a date object in your My Favorites.

138 © 2011 SAP AG. All rights reserved. 2011

Page 157: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Group on time-based data

Lesson Summary

You should now be able to:• Group on time

2011 © 2011 SAP AG. All rights reserved. 139

Page 158: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Lesson: Total grouped data

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Create subtotals

Business Example

Totalling grouped data (subtotals)One of the primary purposes for breaking data into groups is to find a total for eachgroup of records instead of for all the records in the report.

When the program totals data, it sorts the data, breaks it into groups, and then totalsthe values in each group.

Many totaling options are available. Depending on the data type of the object youplan to total, you can do the following:

• 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.

You can add subtotals or grandtotals to your report. A subtotal is used to total partof a series of numbers. For example, you may want to create report that provides atotal of last year's sales for each country in addition to the grand total of last year'ssales for all countries.

To total grouped data

140 © 2011 SAP AG. All rights reserved. 2011

Page 159: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Total grouped data

Before you can total grouped data, you must create a report with grouped data.

1. On the “Insert” tab click Total.2. Select options for your total see below.3. Click Insert.4. If you want to change any of these settings, right-click the total and then click

Format Total.The Format dialog box appears, and you can edit a variety of options.

The following table show available select options for totaling:

Option Description

Total operation The mathematical operation to perform on the groupeddata, such as Count of, Average of, or Maximum.Note: If you are totaling a delegated measure, selectDelegated as the operation.

Totaled object The object on which the calculation is based.

Placement Whether to place the total in a custom location, at all grouplevels, in the report footer, or for each grouping of <object>.

Location Wether to place te total above data or below data.

2011 © 2011 SAP AG. All rights reserved. 141

Page 160: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

142 © 2011 SAP AG. All rights reserved. 2011

Page 161: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Total grouped data

Exercise 12: Inserting subtotals

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Inserting SubtotalsInsert subtotals for the Order ID and Order Amount object in the Order Date group.

1. Open the Grouping on a date object report.

2. Insert a count of the Order ID for each month in the Order Date group.

3. Insert a subtotal on Order Amount for each month in the Order Date group.

4. Add a percentage summary for each month for Order Amount based on theGrand Total in the Order Date group.

5. Add the appropriate text objects beside each summary as labels.

6. Save the report as Inserting Subtotals.

2011 © 2011 SAP AG. All rights reserved. 143

Page 162: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Solution 12: Inserting subtotalsTask: Inserting SubtotalsInsert subtotals for the Order ID and Order Amount object in the Order Date group.

1. Open the Grouping on a date object report.

a) Open the Group on a date object report from your My Favorites .

2. Insert a count of the Order ID for each month in the Order Date group.

a) View your report in Structure mode.

b) Right click the Order ID object in the Body of the report and choose TotalOrder ID ....

c) In the following dialog box choose Count of from the list of availablefunctions.

d) Select for each Grouping of Order Datefrom the last box on the right.

e) Keep the Option: “Location: below data” and click Insert.

f) View your report in Page mode and look at the subtotal.

3. Insert a subtotal on Order Amount for each month in the Order Date group.

a) View your report in Structure mode.

b) Right click the Order Amount object in the Body of the report and chooseTotal Order Amount... .

c) In the following dialog box choose Sum of from the list of availablefunctions if not already selected.

d) Keep the Option: “Location: below data” and click Insert.

e) View your report in Page mode and look at the subtotal.

f) In the Format tab click Decrease decimals twice.

Continued on next page

144 © 2011 SAP AG. All rights reserved. 2011

Page 163: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Total grouped data

4. Add a percentage summary for each month for Order Amount based on theGrand Total in the Order Date group.

a) Go to structure mode and copy the subtotal of Order Amount and paste itunder the existing subtotal.

b) Right-click the copied subtotal and click Format Total.

c) On the left side of the following dialog click on Total.

d) On the right side of the dialog check the Show as percentage of box.

e) Choose “Grand Total” from the list if not already selected.

f) Click Close.

g) View your report in Page mode and look at the percentage summary.

h) In the Format tab click Increase decimals.

5. Add the appropriate text objects beside each summary as labels.

a) On the Insert tab click on Text and place text objects in front of thesubtotals.

b) Enter appropriate text for each subtotal.

c) Resize, position and align the text objects if necessary.

6. Save the report as Inserting Subtotals.

a) Save the report as Inserting Subtotals in your My Favorites.

2011 © 2011 SAP AG. All rights reserved. 145

Page 164: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Lesson Summary

You should now be able to:• Create subtotals

146 © 2011 SAP AG. All rights reserved. 2011

Page 165: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Total column data

Lesson: Total column data

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Total on column data

Business Example

Totaling column data (grand totals)Totaling column data works just like calculating a total for a group only with placingthe total in the report footer or header of the report instead of the footer or header ofa group.

1. On the “Insert” tab click Total.2. Select options for you total. The available options have been explained in the

former lesson of this training guide.3. Choose in the report footer as the placement.4. Choose wether to place the total above data or below data.

In case you choose above data as the location, the total will be placed in the reportheader, in case you choose below data in the report footer.

Note: It is also possible to calculate totals for all existing group levelsincluding grand totals at the same time. You can do this by choosing “at allgroup levels”as the placement of your totals. The option to place the totalsabove or below data does exist in this case as well.

2011 © 2011 SAP AG. All rights reserved. 147

Page 166: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

148 © 2011 SAP AG. All rights reserved. 2011

Page 167: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Total column data

Exercise 13: Inserting grand totals

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Inserting grand totalsInsert a grand total that shows the number of customers and a grand total that showsthe total Order Amount on your report. Describe the grand totals with labels andformat them.

1. Open the Inserting Subtotals report.

2. Change the query to show all customers in the USA.

3. View your Report in Structure Mode.

4. Insert a grand total in the report footer that counts the number of customersdistinctively.

5. Add text objects beside each grand total as labels and format them.

6. View you report in Page mode and make adjustments if necessary.

7. Save your report as Inserting grand totals.

2011 © 2011 SAP AG. All rights reserved. 149

Page 168: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Solution 13: Inserting grand totalsTask: Inserting grand totalsInsert a grand total that shows the number of customers and a grand total that showsthe total Order Amount on your report. Describe the grand totals with labels andformat them.

1. Open the Inserting Subtotals report.

a) Open the Inserting Subtotals report from your My Favorites.

2. Change the query to show all customers in the USA.

a) On the Data tab click Edit Query.

b) In the filters area of the query panel, remove the Region filter and add aCountry filter where Country is equal to USA.

c) Click OK.

3. View your Report in Structure Mode.

a) If you are Viewing the Report in Page Mode click on Structure on top ofCrystal Reports to change to Structure Mode.

4. Insert a grand total in the report footer that counts the number of customersdistinctively.

a) Right click the Customer object in the Body of the report and then clickTotal Customer Name ....

b) Choose Distinct Count from the list of available functions if not alreadyselected.

c) Select in the report footer.

d) Keep “Location: below data” and click Insert.

5. Add text objects beside each grand total as labels and format them.

a) On the Insert tab click on Text and place text objects in front of the grandtotals.

b) Enter appropriate text labels for each grand total.

c) Mark the labels and on the Format tab click on the Bold-Icon.

d) Resize, position and align the text objects if necessary.

Continued on next page

150 © 2011 SAP AG. All rights reserved. 2011

Page 169: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Total column data

6. View you report in Page mode and make adjustments if necessary.

a) If you are viewing the Report in Structure mode click on Page on top ofCrystal Reports to change to Page mode.

7. Save your report as Inserting grand totals.

a) Save your report as Inserting grand totals in your My Favorites.

2011 © 2011 SAP AG. All rights reserved. 151

Page 170: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 6: Sorting, Grouping and Totalling BOCE10

Lesson Summary

You should now be able to:• Total on column data

152 © 2011 SAP AG. All rights reserved. 2011

Page 171: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Unit Summary

Unit SummaryYou should now be able to:• Sort Data• Create and modify groups• Create nested and multiple groups• Reorder groups• Add a custom group based on criteria not specified in the database• Group on time• Create subtotals• Total on column data

2011 © 2011 SAP AG. All rights reserved. 153

Page 172: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

154 © 2011 SAP AG. All rights reserved. 2011

Page 173: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Test Your Knowledge

Test Your Knowledge

2011 © 2011 SAP AG. All rights reserved. 155

Page 174: BOCE10 - Crystal Reports - Fundamentals of Report Design

Test Your Knowledge BOCE10

Answers

156 © 2011 SAP AG. All rights reserved. 2011

Page 175: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 176: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 177: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

157 © 2011 SAP AG. All rights reserved. 2011

Page 178: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

158 © 2011 SAP AG. All rights reserved. 2011

Page 179: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 7Additional Report Objects

Unit Overview[Enter a brief overview of the unit.]

Unit ObjectivesAfter completing this unit, you will be able to:

• Get to know useful predefined objects and how to insert into a report• Create lines and boxes within a report and format them• Insert pictures into a report

Unit ContentsLesson: Predefined Objects .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160Lesson: Graphical Objects .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163

Exercise 14: Inserting Objects to enhance a report. . . . . . . . . . . . . . . . . . . . . . . .167

2011 © 2011 SAP AG. All rights reserved. 159

Page 180: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 7: Additional Report Objects BOCE10

Lesson: Predefined Objects

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Get to know useful predefined objects and how to insert into a report

Business Example

Inserting Predefined ObjectsPredefined Objects (formerly known as Special Fields in prior versions of CrystalReports) contain information that is not included in the database, but is useful to theoverall presentation quality of the report, making your report more readable.

Some of the more commonly used Predefined Objects are:

• Data Date: prints the date the data was last refreshed on a report with saved data.• File Creation Date: prints the date the file was first created.• Modification Date: prints the date 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 overrules page on demand by forcing a total pagecount. That could increase the time span that it takes to show the reportafter opening.

• Page Number: prints the current page number.• Print Date: prints the current date as per your computer’s clock.• Report Comments: prints the contents of the Comments area in the Document

Properties in the File → Summary Info menu.• Report Title: prints the contents of the Title area in the Document Properties

dialog box in the File → Summary Info menu.• Total Page Count: prints the total number of pages in the report.

Note: Most of Predefined Objects that are listed here are automaticallyinserted when you build a new report, but can be removed at any time whenyou do not need them.

160 © 2011 SAP AG. All rights reserved. 2011

Page 181: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Predefined Objects

Use the commands in the "Predefined Objects" area of the "Data Explorer" side panelto add predefined objects to your report.

To insert predefined objects

1. In the “Data Explorer” side panel, expand Predefined Objects.2. Drag a Predefined Object to the desired location on the report canvas.

Each Predefined Object is inserted into the report as an element. An element frameappears. You can now move it on the report.

2011 © 2011 SAP AG. All rights reserved. 161

Page 182: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 7: Additional Report Objects BOCE10

Lesson Summary

You should now be able to:• Get to know useful predefined objects and how to insert into a report

162 © 2011 SAP AG. All rights reserved. 2011

Page 183: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Graphical Objects

Lesson: Graphical Objects

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Create lines and boxes within a report and format them• Insert pictures into a report

Business Example

LinesCrystal Reports allows you to add lines to a report to emphasize important data andcreate professional-looking reports. Lines can run horizontally or vertically. For avertical line to be broken across several pages, the report section that the line endsin must not be on the same page that it starts on. For example, if a line runs from agroup header to the corresponding group footer, the line continues on the top of eachsubsequent page—just below the page header—until the group footer is encountered.

To add lines to a report

1. Click Insert > Line.2. Use the cursor to draw the line where you want it to appear.

Note: You cannot draw diagonal lines.

To edit lines on a report

1. Right-click the line that you want to format and click Format Line.2. In the Format dialog box, change the "General" or "Appearance" options for

the line.3. When you are finished, click Close.

BoxesCrystal Reports allows you to add boxes to a report to emphasize important dataand create professional-looking reports.

2011 © 2011 SAP AG. All rights reserved. 163

Page 184: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 7: Additional Report Objects BOCE10

To add boxes to a report

1. Click Insert > Box.2. Use the cursor to place the box where you want it to appear.3. Use the mouse to adjust the size of he box.

To edit boxes on a report

1. Right-click the box that you want to format and click Format Line.2. In the Format dialog box, change the "General" or "Appearance" options for

the box.3. When you are finished, click Close.

Note: You can set “Corner Rounding” to a box using a number between 0and 100. Depending on how large the number that you enter the box willchange its form. Little numbers will round the corners, large numbers createan elliptic form.

PicturesPictures can add useful and interesting information to your report. For example youwant to insert a company logo in the header of your report.

To insert a picture

1. Click Insert > Picture. The "Open" dialog box appears.2. Select the desired picture file from the file list and click Open.

An element frame appears with the picture inside, ready to be positioned.

3. Position the picture element where you want it to appear on the report andclick to place it.

To create a conditional picture

You can add conditions to a single picture or multiple pictures on your report usingthe "Conditional Picture Expert" dialog box. The conditional pictures are inserted onyour report in a single picture object. For each picture you add to the "ConditionalPicture Expert", you will enter a condition that will determine how the picture isapplied to the report.

Before you create a conditional picture, you must insert a picture on to your report.For each picture you add, you will select an operator and a value to apply to conditionto the picture. The type of operator (for example, equal, not equal, between, notbetween, and greater) affects the value and selection types available for the picture.

164 © 2011 SAP AG. All rights reserved. 2011

Page 185: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Graphical Objects

In order to create a conditional picture do the following steps:

1. Right-click the picture element on your report and click Conditional PictureExpert. The "Conditional Picture Expert" dialog box appears.

2. Click Add Pictures. The "Open" dialog box appears.3. Select the picture files you want to add to the report and click Open. The

"Conditional Picture Expert" dialog box appears with a list of the selectedpicture files.

4. From the "Choose an Object" list, select a result object for each picture.

Hint: You can also type the result object title in the text box. As you typethe result object title, the list automatically filters the list of result objects.

5. In the Operators box, select one of the following operators for the picture.

Depending on the operator you select, the value box displays Enter a Value,Choose Values, or Choose Min/Max Values.

6. From the Value box, set a value for the condition.7. Repeat these step to add conditions to each picture. When you are finished

applying conditions to each picture, click OK.

The conditions are applied to the picture(s).

2011 © 2011 SAP AG. All rights reserved. 165

Page 186: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 7: Additional Report Objects BOCE10

166 © 2011 SAP AG. All rights reserved. 2011

Page 187: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Graphical Objects

Exercise 14: Inserting Objects to enhancea report

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task 1: Insert Predefined objectsInsert a print date, a data date and a page number in your report.

1. Open the Inserting grand totals report.

2. Insert a print date in the Report Header.

3. Insert a data date in the Report Header.

4. Insert a page number in the Page Footer.

5. View your report in Page Mode.

Task 2: Insert graphical objectsInsert a line, a box and a picture in your report.

1. Insert a thick blue line under the column headings of the report.

2. Insert a blue box with middle thickness in the Order Date group.

3. Insert a picture in the Report Header.

4. View you report in Page Mode and look at your enhancements of the report.

5. Save the report as Inserting Objects to enhance the report.

2011 © 2011 SAP AG. All rights reserved. 167

Page 188: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 7: Additional Report Objects BOCE10

Solution 14: Inserting Objects to enhancea reportTask 1: Insert Predefined objectsInsert a print date, a data date and a page number in your report.

1. Open the Inserting grand totals report.

a) Open the Inserting grand totals report from your My Favorites.

2. Insert a print date in the Report Header.

a) View your report in Structure mode and enlarge the report header bypulling it down with the mouse pressed.

b) On the left side of Crystal Reports in the Data Explorer expand thePredefined objects folder.

c) Within the Predefined objects folder mark the “Print Date” object and pullit into the Report Header.

3. Insert a data date in the Report Header.

a) Within the Predefined objects folder select the “Data Date” object and pullit into the Report Header below the Print Date object.

b) If necessary select Print Date and Data date, make them the same sizeand align them.

4. Insert a page number in the Page Footer.

a) Within the Predefined objects folder mark the “Page N of M” object andpull it into the Page Footer below the Print Date object.

Note: The Page N of M object might reduce performance of areport.

5. View your report in Page Mode.

a) If you are viewing the report in Structure mode click on Page on top ofCrystal Reports to change to Page mode.

Continued on next page

168 © 2011 SAP AG. All rights reserved. 2011

Page 189: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Graphical Objects

Task 2: Insert graphical objectsInsert a line, a box and a picture in your report.

1. Insert a thick blue line under the column headings of the report.

a) View your report in Structure mode and enlarge the Page Header by pullingit down with the mouse pressed.

b) On the Insert tab click on Line, move the mouse to the position where theline should start and draw it horizontally to past the last column heading.

c) Right click the line and then click Format Line....

d) In the following dialog click on Appearance on the left side and thenchoose Thickness: 2.0 and Color: Blue on the right side. Click Close.

2. Insert a blue box with middle thickness in the Order Date group.

a) In Structure Mode enlarge Group Header 3 and Group Footer 3 and movedown the group name of the Order Date group so that there is enough spaceto draw a box around the Order Date group information.

b) On the Insert tab click on Box move the mouse to the position where thebox should start and draw it horizontally and vertically to surround all theobjects in Group Header 3, Body and Group Footer 3.

Caution: Make sure the box is not overlapping into anothergroup's header or footer.

c) Right click the box and then click Format Box....

d) In the following dialog click on Appearance on the left side and thenchoose Thickness: 2.0 and Color: Blue on the right side. Click Close.

3. Insert a picture in the Report Header.

a) In Structure Mode double the size of Report Header by pulling it downwith the mouse.

b) On the Insert tab click on Picture.

c) Navigate to the following file location:

d) MyDocuments -> BOCE10 -> Activity_Resources –> Unit 5 -> xtreme.bmp

e) Select the file name and click on Open.

f) Position the picture in the Report Header under the title of the report onthe right side.

Continued on next page

2011 © 2011 SAP AG. All rights reserved. 169

Page 190: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 7: Additional Report Objects BOCE10

4. View you report in Page Mode and look at your enhancements of the report.

a) If you are viewing the report in Structure mode click on Page on top ofCrystal Reports to change to Page mode.

5. Save the report as Inserting Objects to enhance the report.

a) Save your report as Inserting Objects to enhance the report in yourMyFavoritesSAP BO Business Objects folder.

170 © 2011 SAP AG. All rights reserved. 2011

Page 191: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Graphical Objects

Lesson Summary

You should now be able to:• Create lines and boxes within a report and format them• Insert pictures into a report

2011 © 2011 SAP AG. All rights reserved. 171

Page 192: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

Unit SummaryYou should now be able to:• Get to know useful predefined objects and how to insert into a report• Create lines and boxes within a report and format them• Insert pictures into a report

172 © 2011 SAP AG. All rights reserved. 2011

Page 193: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Test Your Knowledge

Test Your Knowledge

2011 © 2011 SAP AG. All rights reserved. 173

Page 194: BOCE10 - Crystal Reports - Fundamentals of Report Design

Test Your Knowledge BOCE10

Answers

174 © 2011 SAP AG. All rights reserved. 2011

Page 195: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 196: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 197: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

175 © 2011 SAP AG. All rights reserved. 2011

Page 198: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

176 © 2011 SAP AG. All rights reserved. 2011

Page 199: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8Formulas

Unit Overview[Enter a brief overview of the unit.]

Unit ObjectivesAfter completing this unit, you will be able to:

• Understand different types of formulas• Get to know formula components• Get to know formula syntax• Use the Formula Workshop• Create, modify and duplicate formulas• Understand and create Boolean formulas• Understand and create If-Then-Else formulas• Get to know basic date functions• Search for functions• Display help on functions• Create numeric calculations with formulas• Get to know useful string manipulation functions

Unit ContentsLesson: Formulas overview ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179Lesson: Working with the Formula Workshop ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183Lesson: Creating and modifying formulas ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187Lesson: Applying Boolean formulas... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191

Exercise 15: Applying a Boolean formula .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193Lesson: Applying If-Then-Else formulas ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197

Exercise 16: Applying an If-Then-Else formula.. . . . . . . . . . . . . . . . . . . . . . . . . . . .199Lesson: Applying date calculations... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202

Exercise 17: Applying date calculations... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205

2011 © 2011 SAP AG. All rights reserved. 177

Page 200: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Lesson: Applying numeric calculations ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211Exercise 18: Applying numeric calculations ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . .215

Lesson: Applying string manipulation ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .220Exercise 19: Applying string manipulation formulas ... . . . . . . . . . . . . . . . . . . . .223

178 © 2011 SAP AG. All rights reserved. 2011

Page 201: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formulas overview

Lesson: Formulas overview

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Understand different types of formulas• Get to know formula components• Get to know formula syntax

Business Example

Introduction to FormulasUsually when you create a report, the data needed already exists in the database folderobjects. For example, to prepare an order list you would place the appropriate objectson the report. Sometimes, however, you need data that does not exist in any of thedata objects. In such cases, you need to create a formula. For example, to calculate thenumber of days it takes to process each order, you need a formula that determines thenumber of days between the order date and the ship date. Crystal Reports makes iteasy for you to create such a formula.

Typical use of formulasThere are many uses for formulas. If you have a need for specialized datamanipulation, you can do it with a formula.

Here are some examples:

- Calculating a percentage of a number

- Extracting a single character from a string

- Combining a string with a number

- Calculating the difference between two dates

2011 © 2011 SAP AG. All rights reserved. 179

Page 202: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Formula componentsFormulas contain two critical parts: the syntax and the components. The syntax is therules that you follow to organize the components. For more information on syntax,see Crystal syntax fundamentals. The components are the pieces that you add to createa formula. You can use any of the following components in your formula.

• Objects• Numbers• Text• Operators• Functions• Control Structures

Formula syntaxWriting formulas is done according to a specific set of rules called syntax. Syntaxrules are used to create correct formulas.

When writing formulas you have the option of using either Crystal syntax or Basicsyntax. Basic Syntax is supposed to be more comfortable for users familiar with MSVisual Basic or other versions of basis. In this Training Guide the Crystal Syntax,which is the original syntax of Crystal Reports, will be explained.

Note: You cannot use both Crystal syntax and basic syntax in the sameformula; however, you can use multiple formulas written in either syntaxwithin the same report.

Special characters used in Crystal Syntax

Character Description

// Denotes everything following is a comment and is ignored by the// Formula Editor. You must repeat the // for each line you wantto be “commented out”.

( ) Denotes the arguments that follow a function. Many functionsrequire ( ) more than one argument separated by a comma withinthe round brackets. Can also denote precedence, forcing parts ofyour formula between the ( ) to evaluate first.

{ } Denotes fields. All types of fields, database, other formulas,special, and so on are enclosed in French braces.

180 © 2011 SAP AG. All rights reserved. 2011

Page 203: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formulas overview

[ ] Denotes subscript or arrays. Square brackets before a functiondenote [ ] an array, whereas square brackets after a functionindicate a subscript (pulling specific characters from a string).

“ ” Denotes literals. Any text between the quotes is printed as itappears between the quotes. This functionality is useful when youwant punctuation, text, or special characters to appear as part ofthe result. Single quotation marks (‘ ’) can also be used for thispurpose.

Upper/Lowercase

Upper or lower case is ignored by the Formula Editor. You canenter your functions in all caps, all lower, or any mix you prefer.

Carriagereturns

Carriage returns are ignored in the Formula Editor. You can haveline breaks and blank lines almost anywhere in the formula. It iscommon practice to break up long formulas into chunks to makethem easier to read and edit.

2011 © 2011 SAP AG. All rights reserved. 181

Page 204: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Lesson Summary

You should now be able to:• Understand different types of formulas• Get to know formula components• Get to know formula syntax

182 © 2011 SAP AG. All rights reserved. 2011

Page 205: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Working with the Formula Workshop

Lesson: Working with the Formula Workshop

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Use the Formula Workshop

Business Example

Introduction to the Formula WorkshopThe Formula Workshop is the central tool within Crystal Reports for creating,modifying and viewing formulas.

You can create different kinds of formulas within the Formula Workshop:

• Normal Formulas: logical, mathematical, string operation, et cetera ...• Selection Formulas: for filtering records• Formatting Formulas: for formatting objects• Functions: for more flexibility and less work

You can create different kinds of formulas in the Formula Workshop. The workshopconsists of:

1. a Toolbar: includes the main buttons to start or view formulas2. a Navigation Panel: lists the different types of formulas3. an Objects Panel: contains components of formulas4. a Formula Area: defines the content of the formula5. a Problems pane: displays errors in the formula

Accessing the Formula WorkshopThere are many ways to access the Formula Workshop. You see it when you add newformula objects, when you define selection formulas, when you work with customfunctions, and so on.

2011 © 2011 SAP AG. All rights reserved. 183

Page 206: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

You can open the Formula Workshop by itself before you begin adding specifickinds of formulas.

To access the Formula Workshop

On the Data tab click Formulas.

Note: Alternatively you can launch the Formula Workshop using the menu:Date -> Formulas ....

Navigation Panel (Formula Workshop)The Navigation panel contains folders for each type of formula you can create inCrystal Reports. It also contains folders for custom functions.

If the workshop appears as the result of using a specific command, it will launch withthe appropriate folder and formula section selected.

Expand any folder in the tree to see existing formulas. New formulas can be added,and existing formulas can be edited or deleted.

Objects Panel (Formula Workshop)The Objects panel contains the primary components to create a formula:

Component Description of Component

Data Explorer The Data Explorer contains any formulas orData Explorer groups already created forthe report.

Result Objects All result objects accessible for your report.

Functions Functions are prebuilt procedures that returnvalues. Custom functions are also listed inthis window. Examples of functions includethe following: average, sum, count, sin,trim, and uppercase.

Operators Operators are the "action verbs" you usein formulas. They describe an operationor an action to take place between two ormore values. Examples of operators includethe following: add, subtract, less than, andgreater than.

Drag any component from these trees to add it to your formula text.

184 © 2011 SAP AG. All rights reserved. 2011

Page 207: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Working with the Formula Workshop

Formula text windowsThe Formulas window is where you create and modify formulas. It displays multipleformulas at once, and you can move between these formulas using the NavigationPanel on the side.

At the bottom of the code window, there are options to Save and Close, Save, orCancel. If you cancel out of the dialog, all changes made will be reverted.

2011 © 2011 SAP AG. All rights reserved. 185

Page 208: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Lesson Summary

You should now be able to:• Use the Formula Workshop

186 © 2011 SAP AG. All rights reserved. 2011

Page 209: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Creating and modifying formulas

Lesson: Creating and modifying formulas

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Create, modify and duplicate formulas

Business Example

Creating a formulaIn order to create a formula do the following steps:

1. In the "Data Explorer" view, right-click within the Formulas box and then clickNew.

The Formula Workshop automatically opens with the new formula selected.

Note: You can also create a new formulas within the Formula Workshopby clicking on the New button or by right-clicking the formulas folderon the left side.

2. In the following dialog box enter a formula name and click OK.3. Create the formula by typing in the components.

Hint:

• CTRL + Space will bring up a list of result objects, functions, andparameters.

• Syntax errors are underlined in red and marked with a red "X" inthe margin. Hover your mouse over the error to view the errormessage.

• Use the Problems view to identify syntax errors in your formula.

4. Save and close the new formula.

2011 © 2011 SAP AG. All rights reserved. 187

Page 210: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

To insert a formula into a report

1. In the "Data Explorer" view, select a formula and drag it to where you want it toappear on your report.

Note: A formula that is placed on a report is indicated by @ (forexample, @ProcessTime).

2. From the File menu, click Save to save the changes to the report.

Editing a formulaIn order to edit a formula do the following steps:

1. In the “Data Explorer” open the Formulas folder.2. Double-click the formula you want to edit.

Note: The formula is displayed on the Formula Workshop.

3. Edit the formula.4. Save and Close the formula.

Renaming a formulaIn order to rename a formula do the following steps:

1. In the “Data Explorer” open the Formulas folder.2. Right-Click the formula and then click Rename.3. Enter the new Name of the formula.4. Press Return.

Duplicating a formulaIn order to rename a formula do the following steps:

1. In the “Data Explorer” open the Formulas folder.2. Right-Click the formula and then click Duplicate.

A copy of the existing formula is created.

Note: Crystal Reports automatically generates a name for the newformula.

3. Rename the new formula as desired.

188 © 2011 SAP AG. All rights reserved. 2011

Page 211: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Creating and modifying formulas

Deleting a formulaWhen a formula is created and added to a report, the Crystal Reports Designer doesthe following:

• Stores the specification for creating the formula, using the name you assignedto 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 tocompletely delete formulas, you must delete the specification and all workingcopies of the formula.

In order to remove a working formula from a report do the following steps:

1. Right-click the formula you want to delete from the report.2. Click Delete.

Note: Even after the working copies of a formula have been deletedfrom the report, the formula specification remains unchanged. Thespecification is listed in the "Data Explorer" view. It is available if youwish to enter the formula in the report again.

In order to delete a formula specification do the following steps:

1. In the “Data Explorer” open the Formulas folder.2. Right-Click the formula and then click Delete.

2011 © 2011 SAP AG. All rights reserved. 189

Page 212: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Lesson Summary

You should now be able to:• Create, modify and duplicate formulas

190 © 2011 SAP AG. All rights reserved. 2011

Page 213: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying Boolean formulas

Lesson: Applying Boolean formulas

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Understand and create Boolean formulas

Business Example

Boolean formulasBoolean formulas usually contain one or more conditions that will be evaluate whenthe formula is processed.

A Boolean formula that evaluates a condition can return the following values:

• True• False

Beside Boolean formulas there are also a Boolean operators that can be used withinCrystal formulas to combine or specify expressions like:AND, OR, NOT and others.

They can be found in the Objects tab in the Operators folder of Formula Workshop.

Conditions that use Boolean operators are called Boolean Expressions.

Creating a Boolean formulaYou can use a Boolean formula to check wether a condition is true or not.For example, to determine whether an order amount matches a certain condition, youwould write a formula like this:

{Orders.Order Amount} > 5000

2011 © 2011 SAP AG. All rights reserved. 191

Page 214: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Depending on the result of this check the formula will return True or False.

Note: You can change how a Boolean value displays in your report byright–clicking the value and selecting the Format option. You then have theoption to display it as 1 or 0, Y or N, Yes or No, True or False, or T or F.

192 © 2011 SAP AG. All rights reserved. 2011

Page 215: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying Boolean formulas

Exercise 15: Applying a Boolean formula

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Create a Boolean FormulaCreate a Boolean formula to evaluate the Country field data for values equal to USA.Show the results on the report.

1. Open the Basic Formulas-1 report.

2. Create a new formula named “Check for USA”, that evaluates the field datain Country for values equal to USA and displays “Yes or No” (without usingIf-Then-Else).

3. Save your report as Applying a Boolean formula.

2011 © 2011 SAP AG. All rights reserved. 193

Page 216: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Solution 15: Applying a Boolean formulaTask: Create a Boolean FormulaCreate a Boolean formula to evaluate the Country field data for values equal to USA.Show the results on the report.

1. Open the Basic Formulas-1 report.

a) On the top menu click File -> Open an local File.

Note: If you are not logged on to your SAP BusinessObjects BIplatform system the menu path will be File -> Open.

b) Navigate to My Documents -> BOCE10 -> Activity_Resources –> Unit 5-> xtreme.bmp

Continued on next page

194 © 2011 SAP AG. All rights reserved. 2011

Page 217: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying Boolean formulas

2. Create a new formula named “Check for USA”, that evaluates the field datain Country for values equal to USA and displays “Yes or No” (without usingIf-Then-Else).

a) In the Data Explorer right click the Formulas folder and click NewFormula ....

b) When prompted type the formula name: Check for USA and click OK.

c) On top of the Formula Workshop click on the Advanced button.

d) On the left side in the Data Explorer open the folder In-use objects anddouble-click the Country object.

e) In the formula area type the rest of the formula = “USA”.

f) The formula should look like this: {Customer\Country} = “USA”.

g) Click Save and Close.

h) View your report in Structure Mode.

i) In the Data Explorer open the Formulas folder.

j) Select the Check for USA formula and drag it to the Body of the report soit is the last column.

Note: The new column will automatically be formatted with 90degree rotation according to the format of the other columns.

k) Right-click the Check for USA formula and choose Format Formulaelement ....

l) In the following dialog box on the left side click on Boolean.

m) From the list of available Boolean Text options select “Yes or No”.

n) Click Close. Go back to Page mode.

When you preview the report “Yes” or “No” appears in the detailsdepending on whether or not the country is equal to “USA”.

3. Save your report as Applying a Boolean formula.

a) Save your report as Applying a Boolean formula in yourMy Favorites SAPBusiness Objects Enterprise folder.

2011 © 2011 SAP AG. All rights reserved. 195

Page 218: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Lesson Summary

You should now be able to:• Understand and create Boolean formulas

196 © 2011 SAP AG. All rights reserved. 2011

Page 219: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying If-Then-Else formulas

Lesson: Applying If-Then-Else formulas

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Understand and create If-Then-Else formulas

Business Example

If-Then-ElseIf-Then-Else formulas give you more flexibility than Boolean formulas because youcan specify the result if the condition is met, f.e. display a certain text.

A If-Then-Else formula consists out of three parts:

1. If: the condition2. Then: the action to be taken if the condition is met.3. Else: the action to be taken when the condition is not met.

Note: The Then-part is mandatory, the Else-part is optional.

The data type must be the same for the Then and Else-Parts of the formula(text, numeric, date).

Creating an If-Then-Else formulaSuppose you want to display a rating beside each customer’s order figures in anorders report depending on the level achieved: high orders or low orders. You canaccomplish a task such as this by using an If-Then-Else formula.

If {Orders.Orders Amount} > 40000 Then "high orders" Else "low orders"

2011 © 2011 SAP AG. All rights reserved. 197

Page 220: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

198 © 2011 SAP AG. All rights reserved. 2011

Page 221: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying If-Then-Else formulas

Exercise 16: Applying an If-Then-Elseformula

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Create an If-Then-Else formulaYou want to display either “Domestic” or “International” when specified conditionsare met. Display “Domestic” when the country value is USA. Display “International”when the country value is not USA.

1. Open the Applying a Boolean formula report.

2. Create a new formula named “Domestic or International” formula to display“Domestic” beside the country values equal to USA and “International” forall others.

3. Save your report as Applying an If-Then-Else formula.

2011 © 2011 SAP AG. All rights reserved. 199

Page 222: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Solution 16: Applying an If-Then-ElseformulaTask: Create an If-Then-Else formulaYou want to display either “Domestic” or “International” when specified conditionsare met. Display “Domestic” when the country value is USA. Display “International”when the country value is not USA.

1. Open the Applying a Boolean formula report.

a) Open the Applying a Boolean formula report from your My Favorites.

2. Create a new formula named “Domestic or International” formula to display“Domestic” beside the country values equal to USA and “International” forall others.

a) In the Data Explorer right click the Formulas folder and click NewFormula ....

b) When prompted type the formula name: Domestic or International andclick OK.

c) In Formula area write a conditional formula, that uses the if x then y elsezcontrol structure (in the Operators section) and that reuses the Check forUSA formula from the list of Formula Fields.

d) The formula should look like this:

IF {@Check for USA} = true then “Domestic” ELSE “International”

Note: The following version will also work: IF {@Check forUSA} then “Domestic” ELSE “International”

e) Click Save and Close.

f) View your report in Structure Mode.

g) In the Data Explorer open the Formulas folder.

h) Select the Domestic or International formula and drag it to the Body of thereport so it is the last column. Go back to Page mode and find "Domestic".

3. Save your report as Applying an If-Then-Else formula.

a) Save your report as Applying an IF-Then-Else formula to your MyFavorites.

200 © 2011 SAP AG. All rights reserved. 2011

Page 223: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying If-Then-Else formulas

Lesson Summary

You should now be able to:• Understand and create If-Then-Else formulas

2011 © 2011 SAP AG. All rights reserved. 201

Page 224: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Lesson: Applying date calculations

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Get to know basic date functions• Search for functions• Display help on functions

Business Example

Date calculationDate calculations especially in combination with existing functions provide you witha variety of possibilities like date-conversion, extraction of date-parts, calculatingtime spans and so on. Therefor it is good to know some typical calculations and datefunctions which can be used in this context.

Examples of calculations using date or date/time fields are:

• Current date function• Addition and subtraction• Year, month, day function

Creating a date calculationCurrent date function

To have today’s date appear on a report, use the current date function. For example, todisplay today’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 anorder should be shipped five days after the order was placed, you would find theexpected ship date with this formula:

202 © 2011 SAP AG. All rights reserved. 2011

Page 225: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying date calculations

{Orders.Order Date} + 5

If the Orders.Order Date was January 10, then this formula would return January 15.

You can also subtract days from date fields by subtracting a number. For example, ifyou want to find the number of days it took to ship an order, if the order date was fivedays prior to the ship date, you would use the formula:

{Orders.Order Date} – 5

If the Orders.Order Date was January 10, then this formula would return January 5.

Another useful application of these concepts is finding the difference in days betweentwo date fields. For example, if you want to find the number of days it took to shipan order, you would use this formula:

{Orders.Ship Date} – {Orders.Order Date}

If the Orders.Ship Date was January 20 and the Orders.Order Date was January 10,then this formula 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.To accomplish this task, you would use the Year ( ), Month ( ), or Day ( ) function.For example, if you were looking for monthly trends in your ordering cycle, youcould use the Month ( ) function to extract the month portion of your order date fieldsusing this formula:

Month ({Orders.Order Date})

If the Orders.Order Date was January 10, then this formula would return 1.00.

Hint: Commas and decimal places are the default display for numbers inCrystal Reports.

2011 © 2011 SAP AG. All rights reserved. 203

Page 226: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

204 © 2011 SAP AG. All rights reserved. 2011

Page 227: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying date calculations

Exercise 17: Applying date calculations

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Create Date Calculation FormulasCalculate the number of days to process each order from the date it was ordered to thedate it was shipped. Calculate the month in which it was ordered. [Remark: This canbe useful for sorting or grouping and creating charts.] Calculate the number of dayssince the order was shipped. Show the results on the report.

1. Open the Applying an If-Then-Else formula report.

2. Change the Orientation of the report to “Landscape”.

3. Create a new formula named “Order Process Time” that displays the number ofdays it took to process each order from the date it was ordered to the date itwas shipped.

4. Create a new formula named “Month Ordered” to display the month in the formof a number.

Note: This formula could be useful if you want to analyze trends of thebusiest order months over several years.

5. Create a new formula named “Days Since Shipped” to display the number ofdays since the order was shipped. The values returned by this formula willchange based on the current date on the actual computer being used.

6. Add the new formula objects to the report and format them.

7. Remove the Country group from the report.

8. Save the report as Applying date calculations.

2011 © 2011 SAP AG. All rights reserved. 205

Page 228: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Solution 17: Applying date calculationsTask: Create Date Calculation FormulasCalculate the number of days to process each order from the date it was ordered to thedate it was shipped. Calculate the month in which it was ordered. [Remark: This canbe useful for sorting or grouping and creating charts.] Calculate the number of dayssince the order was shipped. Show the results on the report.

1. Open the Applying an If-Then-Else formula report.

a) Open the Applying an If-Then-Else formula form your My Favorites SAPBO Enterprise folder.

2. Change the Orientation of the report to “Landscape”.

a) On top the top menu click File -> Page Setup....

b) In the Page Setup dialog box, change the setting to “Landscape” and clickOK

Note: Changing the orientation to “Landscape” provides morespace for adding new columns to the report.

Continued on next page

206 © 2011 SAP AG. All rights reserved. 2011

Page 229: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying date calculations

3. Create a new formula named “Order Process Time” that displays the number ofdays it took to process each order from the date it was ordered to the date itwas shipped.

a) In the Data Explorer right click the Formulas folder and click NewFormula....

b) When prompted type the formula name: Order Process Time and clickOK.

c) On top of the Formula Workshop click on the Advanced button (ifavailable).

d) On the left side in the Data Explorer open the folder Result objects andopen the subfolder Orders by clicking on the plus sign in front of it.

e) Find the Ship date and Order date object.

Note: In case these objects are not available in the Data Exploreryou need to add the Ship date and Order Date to the result objectsarea of your query first.

f) Write a formula that calculates the difference between the values fromthese fields.

The formula should look like this: {Orders\Ship Date} - {Orders\OrderDate}.

g) Click Save. Remain in the Formula Workshop.

Continued on next page

2011 © 2011 SAP AG. All rights reserved. 207

Page 230: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

4. Create a new formula named “Month Ordered” to display the month in the formof a number.

Note: This formula could be useful if you want to analyze trends of thebusiest order months over several years.

a) On top of the Formula Workshop click New and then select New Formula.

b) When prompted, type the formula nameMonth Ordered. Click OK.

c) On the left side of the Formula Workshop expand the Functions folder andthen open the Date and Time folder and find the month function.

d) Double-Click the month function and place the cursor between the bracketsto fill in an argument.

e) In the In-Use objects folder find the Order date object and double-click it.

Your formula should look like this: Month(Orders\Order Date) .

f) Click Save. Remain in the Formula Workshop.

5. Create a new formula named “Days Since Shipped” to display the number ofdays since the order was shipped. The values returned by this formula willchange based on the current date on the actual computer being used.

a) On top of the Formula Workshop click New and then select New Formula.

b) When prompted, type the formula name Days since shipped. Click OK.

c) On the left side of the Formula Workshop expand the Functions folder andthen open the Date and Time folder and find current date function.

Use the current date function to calculate the difference from the ShipDate field.

Your formula should look like this: currentdate - {Orders\Ship Date}.

d) Click Save and Close.

6. Add the new formula objects to the report and format them.

a) View your report in Structure Mode.

b) Expand the Formulas folder and select the three new formulas, that youhave built in this exercise : Order Process Time,Month Ordered, andDays Since Shipped and drag them to the Body of the report.

c) Reduce the size and position of the objects so they fit on the report. Go toPage mode and remove the decimal points for these objects.

Continued on next page

208 © 2011 SAP AG. All rights reserved. 2011

Page 231: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying date calculations

7. Remove the Country group from the report.

a) On the Data tab click on Groups.

b) In the Groups and Sorts dialog select the Country group and then click onthe Delete button on top of the dialog.

c) Click OK.

8. Save the report as Applying date calculations.

a) Save the report as Applying date calculations to your My Favorites.

2011 © 2011 SAP AG. All rights reserved. 209

Page 232: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Lesson Summary

You should now be able to:• Get to know basic date functions• Search for functions• Display help on functions

210 © 2011 SAP AG. All rights reserved. 2011

Page 233: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying numeric calculations

Lesson: Applying numeric calculations

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Create numeric calculations with formulas

Business Example

Numeric calculationsTypical elements of numeric calculations are arithmetical operators, mathematical andsummary functions. Crystal Reports formulas are not limited to include only singlenumeric calculations. By combining functions and expressions with brackets andlogical operators they can become quite complex.

Note: Operators and functions can be found in folders of the FormulaWorkshop.

Creating a numeric calculationArithmetical Operators

Some arithmetic operators available for use in a formulas are:

• addition (+)• subtraction (-)• multiplication (*)• division (/)

For example, you can use the multiplication symbol to find the sales tax charged on aparticular order. If you wanted a sales tax amount of 7% on order amount field, theformula would look like this:

{Orders.Order Amount} * .07

Sum

2011 © 2011 SAP AG. All rights reserved. 211

Page 234: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Summary fields are normally created using the Insert Total dialog box. They thenappear in the Available Objects tree, and can be used in a formula by double–clickingthere. However, they do not need to be created in this way. You can create a summaryfield exclusively for use by your formula by appropriately filling in the arguments toone of the functions in the Summary functions section.

Caution: 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 entirereport.

• Sum ({Orders.Order Amount}, {Customer.Region}) Returns a total of the orderamounts for each region.

Hint: A number of options exist for summarizing your data. Sum( ), Count (), and Average ( ) are the most common. Refer to Summary Functions in theHelp for more information.

Count

This function enables you to count the values that appear in your report (for a specifiedfield). Some examples include these scenarios:

• If a sales report includes all orders made and the amount of each order, you cancompute 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 thatthey come from), you can compute the number of orders per group (in thisexample, per region).

• If you break orders into date or Boolean groups (for example, orders groupedby the month in which they were placed), you can compute the number oforders per group based on a particular change in the date or Boolean field (inthis case, per month).

Distinct Count

This function enables you to get a distinct count of the values that appear in yourreport. A distinct count means that duplicate records are not used in the calculation.

212 © 2011 SAP AG. All rights reserved. 2011

Page 235: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying numeric calculations

Some examples include:

• If a sales report includes all orders made by customers, you can compute the totalcount of distinct customers in the report (as grand total distinct count), excludingany duplicate records. If a customer made more than one order, the duplicateoccurrences of that customer are ignored.

• If you break orders into groups (for example, orders grouped by the region thatthey come from), you can compute the count of distinct customers per group (inthis case, per region). Any customers that made more than one order and appearmore than once in a group are only counted once.

• If you break orders into date or Boolean groups (for example, orders groupedby the month in which they were placed), you can compute count of distinctcustomers in each group based on a particular change in the date or Booleanfields (in this case, the count of customers that placed orders each month). If acustomer placed more than one order within the month, duplicate instancesof that customer are ignored.

2011 © 2011 SAP AG. All rights reserved. 213

Page 236: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

214 © 2011 SAP AG. All rights reserved. 2011

Page 237: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying numeric calculations

Exercise 18: Applying numeric calculations

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Create Numeric Calculation FormulasBased on the Order and Customer data, calculate the order tax, grand totals andsubtotals. Display the results on a report.

1. Open the Applying date calculations report.

2. Create a group based on the Customer object.

3. Create a new formula named “Order Plus Tax” to calculate the Order Amountplus a 7% tax for each order.

4. Create a new formula named “GT Order Amount” to calculate the grand total ofthe order amount for all orders.

5. Create a new formula named “GT Order Amount Plus Tax” to calculate thegrand total of the order amount for all orders plus tax.

6. Create a new formula named “ST Order Amount” to calculate the subtotal of theorder amount per customer.

7. Create a new formula named “ST Order Amount Plus Tax” to calculate thesubtotal of the order amount plus tax per customer.

8. Remove the Customer Name column and place the numeric calculation formulason the report.

9. Save the report as Apply numeric calculations.

2011 © 2011 SAP AG. All rights reserved. 215

Page 238: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Solution 18: Applying numeric calculationsTask: Create Numeric Calculation FormulasBased on the Order and Customer data, calculate the order tax, grand totals andsubtotals. Display the results on a report.

1. Open the Applying date calculations report.

a) Open the Applying date calculations report from your My Favorites.

2. Create a group based on the Customer object.

a) On the Data tab click on Groups.

b) In the Groups and Sorts dialog click on the New button and select“Customer Name”.

c) Click OK.

3. Create a new formula named “Order Plus Tax” to calculate the Order Amountplus a 7% tax for each order.

a) Right Click the Formulas folder and then click New Formula....

b) When prompted, type the formula name: Order Plus Tax. Click OK.

c) In the Formula Editor, select Order Amount to multiply by itself plus a7% tax.

The formula should look like this: {Orders\Order Amount}* 1.07.

d) Click Save. Remain in the Formula Workshop.

4. Create a new formula named “GT Order Amount” to calculate the grand total ofthe order amount for all orders.

a) On top of the Formula Workshop click New and then select New Formula.

b) When prompted, type the formula name GT Order Amount . Click OK.

Write a formula using the sum function applied to the Order Amount field.

Your formula should look like this: sum({Orders\Order Amount})

c) Click Save. Remain in the Formula Workshop.

Continued on next page

216 © 2011 SAP AG. All rights reserved. 2011

Page 239: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying numeric calculations

5. Create a new formula named “GT Order Amount Plus Tax” to calculate thegrand total of the order amount for all orders plus tax.

a) On top of the Formula Workshop click New and then select New Formula.

b) When prompted, type the formula name GT Order Amount Plus Tax.Click OK.

c) Write a formula using the sum function applied to the Order Plus Taxformula.

The formula should look like this: sum({@Order Plus Tax}) .

d) Click Save. Remain in the Formula Workshop.

6. Create a new formula named “ST Order Amount” to calculate the subtotal of theorder amount per customer.

a) On top of the Formula Workshop click New and then select New Formula.

b) When prompted, type the formula name ST Order Amount . Click OK.

c) Write a formula using the sum function applied to the Order Amount perCustomer Name.

The formula should look like this:sum({Orders\Order Amount},{Cus-tomer\Customer Name}).

7. Create a new formula named “ST Order Amount Plus Tax” to calculate thesubtotal of the order amount plus tax per customer.

a) On top of the Formula Workshop click New and then select New Formula.

b) When prompted, type the formula name ST Order Amount Plus Tax.Click OK.

c) Write a formula using the sum function applied to the Order Plus Taxformula per Customer.

The formula should look like this:sum({@Order Plus Tax},{Customer\Cus-tomer Name}).

d) Click Save and Close.

Continued on next page

2011 © 2011 SAP AG. All rights reserved. 217

Page 240: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

8. Remove the Customer Name column and place the numeric calculation formulason the report.

a) Select the Customer Name and delete it. From the Formulas folder drag theOrder Plus Tax formula to the Body of the report.

b) Hold down the Shift to select and drag ST Order Amount and ST OrderAmount Plus Tax to the Group Footer section.

c) Hold down the Shift key to select and drag GT Order Amount and GTOrder Amount Plus Tax to the Report Footer section.

d) Select all the numeric calculation formulas. Format them to display with adollar sign by clicking on the Currency icon on the Format tab.

e) View your report in Page Mode and make adjustments (positioning, sizingand formatting of objects) if necessary.

9. Save the report as Apply numeric calculations.

a) Save your report as Apply numeric calculations in your My Favorites .

218 © 2011 SAP AG. All rights reserved. 2011

Page 241: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying numeric calculations

Lesson Summary

You should now be able to:• Create numeric calculations with formulas

2011 © 2011 SAP AG. All rights reserved. 219

Page 242: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Lesson: Applying string manipulation

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Get to know useful string manipulation functions

Business Example

String manipulationOften, when creating a report, you want to embed the information from several stringfields together as one field. For example, a customer’s first and last name fields canbe combined to be one complete name field. In this way, formatting and movingthis single field around the report is easy.

By using formulas to manipulate the data contained in string fields you can get exactlywhat you need to display on your report..

Creating string manipulation formulasString manipulation formulas include:

• Subscript• Concatenation• Uppercase and Lowercase• Left• Mid• Right

220 © 2011 SAP AG. All rights reserved. 2011

Page 243: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying string manipulation

Subscript

When you want to use only a certain part of a string field, you can extract charactersfrom the string field using the subscript function.

For example, you may want to use only a first initial of a contact name instead of theentire name, or you may want to extract several characters from a string field. In thefirst example, you would create the formula:

{Customer.Contact First Name} [1] Returns "A", where the Contact First Name isAnne-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 FirstName is Anne-Marie

Concatenation

When you want to join two or more components together to form a singular continuousstring, you would use one of the these concatenation symbols:

• + Enables you to join string objects.• & Enables you to join objects of different data types.

For example, if you want to add descriptive text to your data field, you would writethe 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 theUppercase ( ) or Lowercase ( ) functions. For example, to convert all customer namesto uppercase, you would write the formula:

Uppercase ({Customer.Customer Name})

This example would return EDWARD SMITH, where the customer name is EdwardSmith.

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 theLeft function to obtain just the area code from the values in a field containing phonenumbers. You would write the formula:

Left ({Customer.Phone}, 3)

2011 © 2011 SAP AG. All rights reserved. 221

Page 244: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

This formula would retrieve the first three numbers from the phone number, which istypically the area code.

Mid (str, start) or Mid (str, start, length)

The Mid function returns a specified number of characters from a string. The secondargument is the character position where the part to be taken begins. The optional thirdargument is the length of the string you want to be taken out. If the third argument isnot specified, everything from the start position to the end of the string is extracted.Use this function when you need to extract a set of characters from somewhere inthe middle of a text string. For example, you may need to extract the middle twocharacters 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 startingwith the third 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 sideof the specified string. Use this function to obtain just the right part of the string.For example, you may need to obtain the last four digits of social security numbersstored in a field as an employee identifier.

Right({table.SSNUM}, 4)

This formula returns the last four digits of the social security number as a string.

222 © 2011 SAP AG. All rights reserved. 2011

Page 245: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying string manipulation

Exercise 19: Applying string manipulationformulas

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task 1: Group by Formula ResultsCreate a formula that extracts the first letter from the Customer Name data. Group thereport data based on this formula.

1. Open the Applying numeric calculations report.

2. Create a new formula named 1st Customer Letter, which extracts the first letterfrom the Customer Name object.

3. Insert a group based on the 1st Customer Letter formula object.

Task 2: Display Customer Name Groups as all capitalizedCreate a formula to display the Customer Name groups in uppercase.

1. Create a new Display String Formula to capitalize the Customer Name groupson the report.

Task 3: Create a Sentence FormulaCreate a formula to display a sentence that includes the customer name and thesubtotal of their order amount.

1. Create a new formula named DisplaySubtotal to display a sentence including theCustomer Name object and the @ST Order Amount formula.

2. Save the report as Applying String Manipulation formulas.

2011 © 2011 SAP AG. All rights reserved. 223

Page 246: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Solution 19: Applying string manipulationformulasTask 1: Group by Formula ResultsCreate a formula that extracts the first letter from the Customer Name data. Group thereport data based on this formula.

1. Open the Applying numeric calculations report.

a) Open the Applying numeric calculations report from your My Favorites.

2. Create a new formula named 1st Customer Letter, which extracts the first letterfrom the Customer Name object.

a) Right-click the Formula folder and choose New Formula ... .

b) When prompted, type the formula name: 1st Customer Letter. Click OK.

c) On to of the Formula Workshop click the Advanced button.

d) In the Formula area, write a string formula to extract the first characterfrom the Customer Name.

The formula should look like this: {Customer.Customer Name}[1]

Note: Alternatively you could create the following formula:Left({Customer.Customer Name},1).

e) Click Save and Close.

3. Insert a group based on the 1st Customer Letter formula object.

a) On the Data tab click on Groups.

b) In the Groups and Sorts dialog click on the New button and select the1st Customer Letter.

c) Reorder the groups using the UP arrow so that the 1st Customer Lettergroup is on top.

d) Click OK.

e) Format the 1st Customer Letter object in a different color, bold and withan outside border so it stands out on the report.

f) View your report in Page Mode.

Continued on next page

224 © 2011 SAP AG. All rights reserved. 2011

Page 247: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying string manipulation

Task 2: Display Customer Name Groups as all capitalizedCreate a formula to display the Customer Name groups in uppercase.

1. Create a new Display String Formula to capitalize the Customer Name groupson the report.

a) Right-Click the Group Header of the Customer Name group and thenclick Format Group Name element ....

b) On the left side of the Group Name dialog select Advanced.

c) Click on the Display String fx-Icon.

d) Write a formula to display the Customer Name Group Headers withcapitalized letters.

The formula should look like this: Uppercase({Customer\CustomerName}).

e) In the Formula Workshop click Save and Close.

f) In the Group Name dialog click close.

g) View your report in Page Mode .

The Customer Name Group Headers should be capitalized on the report.

Continued on next page

2011 © 2011 SAP AG. All rights reserved. 225

Page 248: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 8: Formulas BOCE10

Task 3: Create a Sentence FormulaCreate a formula to display a sentence that includes the customer name and thesubtotal of their order amount.

1. Create a new formula named DisplaySubtotal to display a sentence including theCustomer Name object and the @ST Order Amount formula.

a) Right-click the Formula folder and choose New Formula ... .

b) When prompted, type the formula name: DisplaySubtotal. Click OK.

c) On to of the Formula Workshop click the Advanced button.

d) Write a formula that combines text, the Customer Name object and STOrder Amount formulat.

The formula should look like this: "The subtotal for " &{Customer\Customer name} & " is " & {@ST Order Amount} & ".

e) Click Save and Close.

f) Replace the Subtotal text object and @ST Order Amount with the newsentence formula @DisplaySubtotal.

g) Format the DisplaySubtotal formula to ensure that it can grow if necessary.

h) View your report in Page Mode.

2. Save the report as Applying String Manipulation formulas.

a) Save the report as Applying String Manipulation formulas.

b) Save the Applying String Manipulation formulas report in your MyFavorites.

226 © 2011 SAP AG. All rights reserved. 2011

Page 249: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Applying string manipulation

Lesson Summary

You should now be able to:• Get to know useful string manipulation functions

2011 © 2011 SAP AG. All rights reserved. 227

Page 250: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

Unit SummaryYou should now be able to:• Understand different types of formulas• Get to know formula components• Get to know formula syntax• Use the Formula Workshop• Create, modify and duplicate formulas• Understand and create Boolean formulas• Understand and create If-Then-Else formulas• Get to know basic date functions• Search for functions• Display help on functions• Create numeric calculations with formulas• Get to know useful string manipulation functions

228 © 2011 SAP AG. All rights reserved. 2011

Page 251: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Test Your Knowledge

Test Your Knowledge

2011 © 2011 SAP AG. All rights reserved. 229

Page 252: BOCE10 - Crystal Reports - Fundamentals of Report Design

Test Your Knowledge BOCE10

Answers

230 © 2011 SAP AG. All rights reserved. 2011

Page 253: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 254: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 255: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

231 © 2011 SAP AG. All rights reserved. 2011

Page 256: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

232 © 2011 SAP AG. All rights reserved. 2011

Page 257: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9Conditional Formatting

Unit Overview[Enter a brief overview of the unit.]

Unit ObjectivesAfter completing this unit, you will be able to:

• Use the Conditional Formatting Dialog• Use Conditional formulas• Format Fields conditionally with formulas• Get to know the options available to format sections• Format sections conditionally• Drill down on Sections

Unit ContentsLesson: Formatting Objects conditionally .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234

Exercise 20: Using the Conditionally Formatting Dialog ... . . . . . . . . . . . . . . .237Lesson: Formatting Fields conditionally with formulas... . . . . . . . . . . . . . . . . . . . . . .241

Exercise 21: Using Formulas to conditionally formatting fields... . . . . . . . .243Lesson: Formatting Sections ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247Lesson: Formatting Sections conditionally .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252

Exercise 22: Formatting Sections ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .253Lesson: Drill down on Sections ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .258

Exercise 23: Create a multi-level drill down report . . . . . . . . . . . . . . . . . . . . . . . . .259

2011 © 2011 SAP AG. All rights reserved. 233

Page 258: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

Lesson: Formatting Objects conditionally

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Use the Conditional Formatting Dialog• Use Conditional formulas

Business Example

Introduction to Conditional FormattingConditional formatting is formatting that applies only under certain conditions. Forexample, in a report you may want any of these formats when certain conditionsare met:

• Customer balances are printed in red, if they are past due.• Dates appear in the Day, Month, Year format, if the customer is German.• A background color appears, if the line number is odd..

Crystal Reports makes it easy to apply conditional formatting in these and manyother situations.

With absolute formatting, you follow the "select, then apply" procedure. Forconditional formatting, you follow the same general procedure, but you go a stepfurther and set up conditions that determine whether or not the formatting will beapplied. You specify these conditions using simple formulas. When a conditionalformatting formula is set up, the formula overrides any fixed settings you have madein the Format dialog box. For example, if you select the Hide property, then set upa conditional formula for the Hide property, the property will still apply only if thecondition in the formula is met.

Crystal Reports enables you to set both on and off properties and set attributeproperties conditionally. However, each of these requires a different kind of formula.

If you want to conditionally format objects you can do this either by using theConditionally formatting dialog or with Formulas.

234 © 2011 SAP AG. All rights reserved. 2011

Page 259: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Objects conditionally

The Conditionally formatting dialog gives you the possibility to easily create andcombine formatting conditions and the possibility to define what kind of formattingshall be done when the conditions are met.

Formulas allow you to define conditions in relation to one specific property ofan object like color, style, border and so on. To create these kind of formulas isusually more work than using the conditionally formatting dialog but gives you moreflexibility if needed.

Using the Conditionally Formatting DialogIf you want to use the Conditionally Format dialog in order to create conditionalformatting for an object do the following steps:

1. Right-click the object you want to format and click Conditional Formatting.The Formatting dialog box appears.

2. In the Formatting dialog box, click on the Add Condition button.3. On the "Condition" pane, select a result object in the object list.

Note: You have to click on it to be able to select elements.

4. Select an operator for the result object in the operator list.5. Select a value in the value list.6. On the Formatting Settings pane, select one or more font properties to be applied

when a condition is true.7. Add values for each font property.8. Click OK to apply conditions.

2011 © 2011 SAP AG. All rights reserved. 235

Page 260: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

236 © 2011 SAP AG. All rights reserved. 2011

Page 261: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Objects conditionally

Exercise 20: Using the ConditionallyFormatting Dialog

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Using the Conditionally Formatting DialogHighlight report data based on the following conditions:- When the order amount is $100 or less, display that data in red- When the order amount is $5000 and greater, display that data in blue- When the order amount is $10000 and greater, display that data in purple

1. Open the Conditional Reporting-1 report.

2. Format the Order Amount Object using the Conditionally Formatting dialog.

3. Save the report as Using the Conditionally Formatting Dialog.

2011 © 2011 SAP AG. All rights reserved. 237

Page 262: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

Solution 20: Using the ConditionallyFormatting DialogTask: Using the Conditionally Formatting DialogHighlight report data based on the following conditions:- When the order amount is $100 or less, display that data in red- When the order amount is $5000 and greater, display that data in blue- When the order amount is $10000 and greater, display that data in purple

1. Open the Conditional Reporting-1 report.

a) Open the Conditional Reporting-1report from the local BOCE10folder using the following menupath: File -> Open a local File -> MyDocuments -> BOCE10 -> Activity_Resources -> Unit 9 -> ConditionalReporting-1.rpt

2. Format the Order Amount Object using the Conditionally Formatting dialog.

a) Using the steps described below create the following condition:

- When the order amount is $100 or less, display that data in red.

b) Right-Click the Order Amount object in the Body Section and chooseConditional Formatting....

c) In the Formatting dialog box click on the Add Condition button.

d) On the Condition pane select Order Amount as the result object, choosethe operator is less or equal to and enter “100” as the value.

e) In the property part of the Formatting dialog check “Font Color” andselect the Color“ Red”.

f) Using the same sequence of steps described in a) to d) create the followingcondition additionally:

- When the order amount is $5000 and greater, display that data in blue.

g) Using the same sequence of steps described in a) to d) create the followingcondition additionally:

- When the order amount is $10000 and greater, display that data in purple.

h) Move the third condition to the second position in the list of conditionsusing the UP-arrow and click the OK button.

i) View your report in Page Mode.

Continued on next page

238 © 2011 SAP AG. All rights reserved. 2011

Page 263: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Objects conditionally

3. Save the report as Using the Conditionally Formatting Dialog.

a) Save the report as Using the Conditionally Formatting Dialog.

b) Save the report as Using the Conditionally Formatting Dialog to yourMy Favorites.

2011 © 2011 SAP AG. All rights reserved. 239

Page 264: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

Lesson Summary

You should now be able to:• Use the Conditional Formatting Dialog• Use Conditional formulas

240 © 2011 SAP AG. All rights reserved. 2011

Page 265: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Fields conditionally with formulas

Lesson: Formatting Fields conditionally with formulas

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Format Fields conditionally with formulas

Business Example

Using formulas to conditionally formatting fieldsFormatting Formulas give you the possibility to create simple or complex conditionsthat determine whether an objects is formatted in a certain way.

When you right-click an object and choose Format Result object Element ... theFormatting dialog opens. In many cases you will see an fx-Icon behind the availableformatting options. That means for this Formatting Option you can create a formattingcondition in the Formula Workshop . If an condition is already existing for aformatting option you will see a green hook attached to the fx-Icon.

Before working with formatting formulas it is useful to understand the differencebetween conditional on-off properties and conditional attribute properties.

A conditional "on" or "off" property tests to see if a condition has been met. It ison if the condition is met, off if the condition is not met. Use Boolean formulas forthis kind of formatting.

Crystal syntax example: {Customer.Country} = "Canada"

A conditional attribute property tests to see which of two or more conditions is met.The program then applies the formatting appropriate to the condition. For example,assume that you want values under Report Layout and Formatting quota printed inred and all other values printed in black. The program tests to see whether the valueis under quota or not. If it is under quota, then it applies the red attribute; if it isnot, then it applies the black attribute.

Crystal syntax example: If {CUSTOMER.LAST_YEARS_SALES} > 5000 Then crRedElse crBlack

2011 © 2011 SAP AG. All rights reserved. 241

Page 266: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

When you create formulas for conditional attribute properties, Crystal Reports showsyou a selection of attributes in the formula comments area within the Formulas view.You can use any of these attributes in your formula. For example, if you are setting abackground color conditionally, the selection contains attributes for each color thatyou can use. If you are setting borders conditionally, the selection contains attributessuch as crSingleLine, crDoubleLine, crDashedLine, crDottedLine, and crNoLine.

Caution: Always include the Else keyword in conditional formulas;otherwise, values that don't meet the If condition may not retain their originalformat. To retain the original format of values that don't meet your Ifcondition, use the DefaultAttribute function. The DefaultAttribute functionreturns the value of the formatting property set in the "Properties" dialog box.

Crystal syntax example: If {CUSTOMER.LAST_YEARS_SALES} > 5000 Then crRedElse DefaultAttribute.

You can take this kind of property one step further. You can specify a list of conditionsand a property for each; you are not limited to two conditions. For example, if youhave a number object on your report that contains sales figures from countries aroundthe world, you can specify the number attribute(s) that you want to apply to eachcountry. In this case, your conditions would specify that if it is from Country A, theprogram should apply the Country A attribute; if it is from Country B, the Country Battribute; if it is from Country C, the Country C attribute, and so on.

With more than two alternatives, use this kind of formula:

Crystal syntax example: If {CUSTOMER.Country} = "Canada" Then crRed Else If{CUSTOMER.Country} = "England" Then crBlack Else If {CUSTOMER.Country} ="Australia" Then crGreen Else crBlue

242 © 2011 SAP AG. All rights reserved. 2011

Page 267: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Fields conditionally with formulas

Exercise 21: Using Formulas to conditionallyformatting fields

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Apply Conditional Formatting with formulasApply conditional formatting to Customer Name data. When the order amount is$100 or less, display the customer name with white font and a red background. Aswell, when the order amount is greater than $5000, format the customer name with adrop shadow.

1. Open the Using the Conditionally Formatting Dialog report.

2. Specify conditions to formatting options for the Customer Name object.

3. Save your report as Using formulas to conditionally format objects.

2011 © 2011 SAP AG. All rights reserved. 243

Page 268: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

Solution 21: Using Formulas to conditionallyformatting fieldsTask: Apply Conditional Formatting with formulasApply conditional formatting to Customer Name data. When the order amount is$100 or less, display the customer name with white font and a red background. Aswell, when the order amount is greater than $5000, format the customer name with adrop shadow.

1. Open the Using the Conditionally Formatting Dialog report.

a) Open the Using the Conditionally Formatting Dialog report from yourMy Favorites.

Continued on next page

244 © 2011 SAP AG. All rights reserved. 2011

Page 269: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Fields conditionally with formulas

2. Specify conditions to formatting options for the Customer Name object.

a) Create the following conditions using a formatting formula:

When the order amount is $100 or less, display the customer name withwhite font and a red background.

b) Right click the Customer Name object in the Body section and chooseFormat Result object Element ....

c) In the Formatting dialog mark “Font” on the left side and click the fx-Iconbeside “Color:” .

d) In the formula area create the following formula: If {Customer.Orders\OrderAmount}< 100 then crwhite else crblack.. Save and Close.

e) In the Formatting dialog mark “Appearance” on the left side and clickthe fx-Icon beside “Fill:” .

f) In the formula area create the following formula:If {Customer.Orders\OrderAmount}"< 100 then crred else crnocolor... Save and Close.

g) Create the following condition using another formatting formula:

When the order amount is greater than $5000, format the customer namewith a drop shadow.

h) In the Formatting dialog mark “Appearance” on the left side and clickthe fx-Icon beside “Drop shadow:” .

i) In the formula area create the following formula: {Customer.Orders\OrderAmount}"> 5000 . Save and Close.

j) Click Close.

k) View you report in Page Mode and check your results.

3. Save your report as Using formulas to conditionally format objects.

a) Save your report as Using formulas to conditionally format objects inyour My Favorites.

2011 © 2011 SAP AG. All rights reserved. 245

Page 270: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

Lesson Summary

You should now be able to:• Format Fields conditionally with formulas

246 © 2011 SAP AG. All rights reserved. 2011

Page 271: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Sections

Lesson: Formatting Sections

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Get to know the options available to format sections

Business Example

Introduction to Section FormattingSection Formatting offers a lot of possibilities to the Crystal Reports Designer. Itincludes General Options like formatting sections with color, hiding or underlayingthem. It also include Paging Options. They can help to control when page breaksappear in a Crystal Report. Combining Section Formatting with Conditions provideseven more flexibility in designing a report.

Options on the General TabColor a Section

Use the Color tab to set the background color for the desired section. You can select acolor for the section you want to format from a list. By combining it with a conditionyou can define when a certain color shall be used for formatting a section.

Hide

Hide 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 constitutesthat summary value.

Hide if Blank

This command suppresses or prevents printing of the section if all fields in that sectionare blank. A typical use is in the creation of a mailing label report where there is nosecond address line and you do not want a gap to print. This command can be madeconditional by clicking the formula button then entering a Boolean formula.

Print at Bottom of Page

2011 © 2011 SAP AG. All rights reserved. 247

Page 272: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

This option forces whatever is in that section to be printed as low on the page aspossible. In a report that generates invoices, for example, you would want eachinvoice to have the total printed at the bottom of the page. That way, all invoices havethe total printed in the same place, no matter how many entries are on the invoice.This command can be made conditional by clicking the formula button then entering aBoolean formula.

Underlay Following Sections

You may want to create a section underlay to add an image of a pre-printed form to areport, or to add a watermark to a report.

To create the underlay, you first add a picture or watermark to your report and thenyou reset the formatting so that the element underlays the report data.

Relative Positions

This option allows you to lock the relative position of a report object next to a gridobject within a section.

Note:

• Only horizontal locking is possible. If you need to preserve relativevertical positioning, you should create a new report section.

• Once Relative Positions is selected for a section, you can no longer dragobjects to new positions within that section. To change an object’sposition, use the Object Size and Position dialog box.

• Relative positioning applies only to objects placed to the right of gridobjects (that is, objects that can grow horizontally).

Options on the Paging TabPage Break Before

Page Break Before is an available format property for Group (header and footer) andDetails sections. When you select this option, the program inserts a page break beforeit prints the section. 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).

If you have a subtotal or summary field in a Group Footer section, you can use the PageBreak Before option to put these values on pages following the value being totaled.

Page Break After

248 © 2011 SAP AG. All rights reserved. 2011

Page 273: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Sections

When the End of Section check box is selected, the program inserts a page breakafter the section.

• The Page Header and Page Footer appear on each page.• Use Page Break After in the Group Footer section to print each group on a

separate page.

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 spansseveral pages, you see page 1, page 2, and so on, of the group. Then, when CrystalReports goes to the next group, you see page 1, page 2, and so on, again.

Avoid Page Break

This option prevents page breaks from spreading data from a single record over twopages. Therefore, if you have multiple lines in the Detail section, all the informationfor each detail line would stay together on one page if you turn the Avoid Page BreakOption on. This command can be made conditional by clicking the formula buttonthen entering a Boolean formula.

Page Orientation

Allows you to set page orientation for each section in the report except for the PageHeader and Page Footer. The default setting will be the same as the report pageorientation in the Page Setup dialog box.

Other Section Options (Depending on Section type)Depending on which section you are working with you might have additional optionsfor Section Formatting. For example if you are working with a Group Header orGroup Footer you will see the following Options within the Section Formatting dialogon the Paging tab:

Avoid Page Break in Group

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

Repeat Group Header on Each Page

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

New page after n visible groups.

2011 © 2011 SAP AG. All rights reserved. 249

Page 274: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

This Option allows you to define after how many groups a page break shall beinserted. That means when you check this option and enter the value 2 for n CrystalReports will show 2 groups, then insert a page break and then show the next 2 groups.

250 © 2011 SAP AG. All rights reserved. 2011

Page 275: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Sections

Lesson Summary

You should now be able to:• Get to know the options available to format sections

2011 © 2011 SAP AG. All rights reserved. 251

Page 276: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

Lesson: Formatting Sections conditionally

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Format sections conditionally

Business Example

Combine Section Options with formula conditionsSection Formatting already offers quite a bit of options. Combining SectionFormatting with formulas conditions gives even more possibilities.

For example if you want to alternate the Color Formatting in a report so that one linehas a color and the next one has not you could write a formula that looks like that:

If remainder(recordnumber,2) = 1 then silver else nocolor

and attach it to the Color Option for Section Formatting.

When you work with the Paging Options within the area of Section Formatting youmight have some side effects you want to avoid.

For example if you format a report with page breaks by inserting the Page BreakBefore Option you could receive an empty first page. In order to avoid this you couldattach a formula to the Page Break Option which looks like this:

Not OnFirstRecord

The empty fist page will not appear any more in your report.

252 © 2011 SAP AG. All rights reserved. 2011

Page 277: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Sections conditionally

Exercise 22: Formatting Sections

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Formatting SectionsCreate a new report that shows Customers Last Year's Sales Revenue grouped byCountry. Suppress Sections that are not needed. Show every Country on a separatepage. Avoid an empty first page and orphaned totals. Format the Country GroupHeader with a silver background.

1. Create a new Report as a blank report.

2. Create a new query based on the Xtremeplus_CR Universe including Country,Customer Name and Last Year's Sales as result objects.

3. Create a group based on the Country object.

4. Create a Subtotal and a Grand total based on the Last Year's Sales Object.

5. Create a Report Title with the name “Country Report”.

6. View the report in Structure Mode. Suppress all Sections that are not needed.

7. Show every Country on a separate page. Avoid an empty first page and orphanedtotals.

8. Format the Country Group Header with a silver background.

9. Save your report as Country Report.

2011 © 2011 SAP AG. All rights reserved. 253

Page 278: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

Solution 22: Formatting SectionsTask: Formatting SectionsCreate a new report that shows Customers Last Year's Sales Revenue grouped byCountry. Suppress Sections that are not needed. Show every Country on a separatepage. Avoid an empty first page and orphaned totals. Format the Country GroupHeader with a silver background.

1. Create a new Report as a blank report.

a) Start -> Programs -> Crystal Reports for Enterprise

b) Form the start page click Blank Report.

c) Logon to SAP Business Objects Enterprise if not already done.

d) Choose the Xtremeplus_cr universe as your data source.

2. Create a new query based on the Xtremeplus_CR Universe including Country,Customer Name and Last Year's Sales as result objects.

a) Use the following objects as result objects in your query:

Country, Customer Name, Last Year's Sales

b) Click Finish.

c) View your report in Page Mode.

3. Create a group based on the Country object.

a) View your report in Structure Mode.

b) On the Data tab click on Groups..

c) Select the Country object.

d) Click Insert.

e) Select the Country object in the Body of the report and delete the Countrycolumn by right-clicking on the column header.

f) Shrink the Group Header fit (as small as possible, remove empty space).

g) Change the left Margin to 1 inch: Files -> Page Setup _> Margin left: 1in . Click OK.

h) View your report in Page Mode.

Continued on next page

254 © 2011 SAP AG. All rights reserved. 2011

Page 279: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Sections conditionally

4. Create a Subtotal and a Grand total based on the Last Year's Sales Object.

a) Right-Click the Last Year's Sales object in the Body section and chooseTotal Last Year's Sales ....

b) In the following dialog box keep Sum of from the list of available functions.

c) Select At all group levels.

d) Keep “Location: below data” and click Insert.

e) Shrink the Group Footer as small as possible (remove empty space).

f) View your report in Page Mode.

5. Create a Report Title with the name “Country Report”.

a) On the Insert tab click on the Text element Icon.

b) In the report click on the place where you want to insert the text elementand then pull it to the desired size.

c) Double-click into the text box and type “Country Report”.

d) Format the text as following: Arial 14, Align Centred and Outside border.Click Close.

6. View the report in Structure Mode. Suppress all Sections that are not needed.

a) Hide the part of the Page Header that contains the Report Title,Modification date and so on by right-clicking it and choose Hide.

b) Hide the Page Footer by right-clicking it and choose Hide.

c) View the report in Page Mode.

Continued on next page

2011 © 2011 SAP AG. All rights reserved. 255

Page 280: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

7. Show every Country on a separate page. Avoid an empty first page and orphanedtotals.

a) View the report in Structure Mode.

b) Right-Click the Group Header and choose Format Group Header .

c) In the Format section dialog select Paging on the left side and check “PageBreak Before”.

d) Click Close.

e) View your report in Page Mode. When you click through the pages youwill see that each group starts on a new page, but the first page of the reportis empty. In order to avoid this do the following step.

f) Go to Structure Mode. Format the Group Header. Find the “Page BreakBefore” Option and click the fx-Icon beside it.

g) Write the following formula: Not OnFirstRecord

h) Click Save and Close.

i) Click Close.

8. Format the Country Group Header with a silver background.

a) Right-click the Group Header section (the section itself on the right) andchoose Format Section....

b) In the Format section dialog mark General on the left side and select“Silver” as the background Color in the Element area. Click Close.

c) View your report in Page Mode and make adjustments if necessary.

9. Save your report as Country Report.

a) Save your report as Country report to your My Favorites.

256 © 2011 SAP AG. All rights reserved. 2011

Page 281: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Sections conditionally

Lesson Summary

You should now be able to:• Format sections conditionally

2011 © 2011 SAP AG. All rights reserved. 257

Page 282: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

Lesson: Drill down on Sections

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Drill down on Sections

Business Example

Drilling Down on a SectionThe "Show on Drill Only" property hides a section whenever you run the report.For example, in a summary report, the "Show on Drill Only" property can be usedto display only the summaries, but not the details behind the summaries. When the"Show on Drill Only" property is applied to a section, it becomes visible when theDrill-down cursor is used to drill down on the section contents. This property isabsolute; it cannot be conditionally applied using a formula.

To drill-down on group headers

1. Right-click the "Body" section and click Format Body.2. In the Format dialog box, in the General section, select Show on Drill Only.3. Click Close.4. Double-click the group header to show the hidden section.

Caution: Depending on where you right click a section you will receive adifferent context menu.

• When you right-click the word Body of the Body Section you will seeFormat Body ... in the context menu. In the following dialog, in thegeneral section, you can click the “Show on Drill only” checkbox.

• When you right-click on the right side from the word Body you will seeFormat Section... in the context menu. In the following dialog you canfind additional formatting options like print at bottom of page, underlay,relative positions, but not “Show on Drill only”.

258 © 2011 SAP AG. All rights reserved. 2011

Page 283: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Drill down on Sections

Exercise 23: Create a multi-level drill downreport

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Create a multi-level drill down reportCreate a report that includes the following group levels: 1. Country - 2. Region - 3.City - Details. Only the Country group shall be visible in the initial view of the report.When double-clicking on a country, the regions of this country shall show. Whendouble-clicking on a region, the cities of this region shall show. When double-clickingon a city, the details of this city shall show. The details contain the objects CustomerName and Last Year's Sales.

This report can be created starting from your Country report, which already includesa Country group and detail information. Before adding the other groups the reportneeds some modification.

1. Open the Country Report.

2. Take out the Page Break Before Option from the Report Header.

3. Add the Region and the City object to the result area of your query.

4. Insert a Region and a City group in your report.

5. Create Subtotals for all group levels in the Group Headers.

6. Format the Sections as needed.

7. Drill down on the groups of your report.

8. Save your report as Create a multi-level drill down report.

2011 © 2011 SAP AG. All rights reserved. 259

Page 284: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

Solution 23: Create a multi-level drill downreportTask: Create a multi-level drill down reportCreate a report that includes the following group levels: 1. Country - 2. Region - 3.City - Details. Only the Country group shall be visible in the initial view of the report.When double-clicking on a country, the regions of this country shall show. Whendouble-clicking on a region, the cities of this region shall show. When double-clickingon a city, the details of this city shall show. The details contain the objects CustomerName and Last Year's Sales.

This report can be created starting from your Country report, which already includesa Country group and detail information. Before adding the other groups the reportneeds some modification.

1. Open the Country Report.

a) Open the Country report from your My Favorites.

2. Take out the Page Break Before Option from the Report Header.

a) View the report in Structure Mode.

b) Right click the Group Header section and choose Format Group Header....

c) Mark Paging on the left side and find the “Page Break Before” Option.

d) Click on the fx-Icon beside the Page Break Before Option and delete thecontent of the formula.

e) Click Save and Close.

f) Uncheck the Page Break Before Option and click Close.

g) View your report in Page Mode. You should be able to see all the countrieslisted and details for each country.

3. Add the Region and the City object to the result area of your query.

a) On the Data tab click on Edit Query.

b) From the Customer folder drag the Region and the City object over to theResult objects area.

c) Click OK.

Continued on next page

260 © 2011 SAP AG. All rights reserved. 2011

Page 285: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Drill down on Sections

4. Insert a Region and a City group in your report.

a) View your report in Structure Mode.

b) On the Insert tab click on Group.

c) In the following dialog box click on Edit groups.

d) On top of the Groups and Sorts dialog click on the New button and select“Region” from the list.

e) Click on the New button a second time and select “City” from the list.

f) Make sure you have the following group order: Country - Region - City.Click OK.

g) Shrink all Group Headers.

5. Create Subtotals for all group levels in the Group Headers.

a) Right click the Last Year's Sales object in the Body section and chooseTotal Last Year's Sales ....

b) Define “Sum of” Last Year's Sales “for all group Levels” “Above Data”and click Insert.

c) Delete the Grandtotal in the Report Header.

6. Format the Sections as needed.

a) Hide Group Footer 2 and 3 by right-clicking them and then click on Hide.

Note: Group Footer 1 will be visible (not hidden) and show theGrand Total.

b) Format Group Header 2 and 3 with “Show on Drill Only” by checking thisoption in the General part of the Group Header Format dialog.

Note: You have to right click the word Group Header 2 in orderto see Format Group Header 2 .... in the context menu. Do thesame for Group Header 3.

c) Format the Body of the report with “Show on Drill Only”.

Continued on next page

2011 © 2011 SAP AG. All rights reserved. 261

Page 286: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 9: Conditional Formatting BOCE10

7. Drill down on the groups of your report.

a) View the report in Page Mode.

b) Find the country “Germany” .

Note: In order to find an element you can use the Search tool fromthe Data Explorer.

c) Double-Click on Germany. A new page with Germany and GermanRegions opens.

d) Double-Click on “Nord-Rhein-Westfalen”. A new page with Cities inNord-Rhein-Westfalen opens.

e) Double-Click on “Bonn”. A new page with the customer details opens.

Hint: After drilling down several levels, notice on top there willbe "Go Back" and "Go Forward" arrows. These arrows will allowyou to navigate between the drilldown levels. You can also seethe drilldown path.

8. Save your report as Create a multi-level drill down report.

a) Save your report as Create a multi-level drill down report to your MyFavorites.

262 © 2011 SAP AG. All rights reserved. 2011

Page 287: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Drill down on Sections

Lesson Summary

You should now be able to:• Drill down on Sections

2011 © 2011 SAP AG. All rights reserved. 263

Page 288: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

Unit SummaryYou should now be able to:• Use the Conditional Formatting Dialog• Use Conditional formulas• Format Fields conditionally with formulas• Get to know the options available to format sections• Format sections conditionally• Drill down on Sections

264 © 2011 SAP AG. All rights reserved. 2011

Page 289: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Test Your Knowledge

Test Your Knowledge

2011 © 2011 SAP AG. All rights reserved. 265

Page 290: BOCE10 - Crystal Reports - Fundamentals of Report Design

Test Your Knowledge BOCE10

Answers

266 © 2011 SAP AG. All rights reserved. 2011

Page 291: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 292: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 293: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

267 © 2011 SAP AG. All rights reserved. 2011

Page 294: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

268 © 2011 SAP AG. All rights reserved. 2011

Page 295: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10Charting

Unit Overview[Enter a brief overview of the unit.]

Unit ObjectivesAfter completing this unit, you will be able to:

• Insert and create a chart• Create a chart on grouped data• Create a chart on detailed data• Get to know the formatting options of a chart• Apply formatting options to a chart

Unit ContentsLesson: Charting Concepts.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .270Lesson: Charting on grouped data ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .276

Exercise 24: Charting on grouped data ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279Lesson: Creating a chart on detailed data... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .284

Exercise 25: Charting on detailed data ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285Lesson: Formatting Charts .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288

Exercise 26: Customizing a chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291

2011 © 2011 SAP AG. All rights reserved. 269

Page 296: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10: Charting BOCE10

Lesson: Charting Concepts

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Insert and create a chart

Business Example

Introduction to ChartingCharts in reports make report data more meaningful and easier to understand. Youcan present summarized data in colorful, easy-to-read charts. There are a number ofchart layouts and types that can be used within your reports and formatted dependingon your needs.

You can use charts any time you want to represent data visually in a report.

For example, if you have a sales report grouped by Region with a subtotal of LastYear's Sales for each region, you can create a chart that displays Sales per Region.

You can chart on body, formula, and running total objects.

Chart Types and SubtypesDifferent sets of data are particularly suited to a certain chart type. The following is anoverview of the main chart types and their most common uses.

Bar

270 © 2011 SAP AG. All rights reserved. 2011

Page 297: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Charting Concepts

Most bar charts (also known as a column chart) display or compare several sets ofdata. Two useful bar charts are the Side-by-Side bar chart and the Stacked bar chart.

• Side-by-Side bar chart

A Side-by-Side bar chart displays data as a series of vertical bars. This type ofchart is best suited for showing data for several sets over a period of time (forexample, last year's sales figures for AZ, CA, OR, and WA).

• Stacked bar chart

A Stacked bar chart displays data as a series of vertical bars. This type of chartis best suited for representing three series of data, each series represented by acolor stacked in a single bar (for example, sales for 1997, 1998, and 1999).

Line

A line chart displays data as a series of points connected by a line. This type of chartis best suited for showing data for a large number of groups (for example, total salesover the past several years).

Area

An area chart displays data as areas filled with color or patterns. This type of chart isbest suited for showing data for a limited number of groups (for example, percentageof total sales for AZ, CA, OR, and WA).

Pie

A pie chart displays data as a pie, split and filled with color or patterns. Pie charts aretypically used for one group of data (for example, the percentage of sales for the entireinventory); however, you can choose multiple pie charts for multiple groups of data.

Doughnut

A doughnut chart is similar to a pie chart, displaying data as sections of a circle ordoughnut. If, for example, you charted sales by region on a particular report, youwould see the total number of sales (the figure) in the center of the doughnut and theregions as colored sections of the doughnut. As with the pie chart, you can choosemultiple doughnut charts for multiple groups of data.

3-D-Riser

A 3-D Riser chart displays data in a series of 3-dimensional objects, lined upside-by-side, in a 3-dimensional plane. The 3-D Riser chart shows the extremes inyour report data. For example, the differences between sales by customer by countryare visually dynamic when presented in this chart.

3-D Surface

2011 © 2011 SAP AG. All rights reserved. 271

Page 298: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10: Charting BOCE10

3-D Surface charts present a topographic view of multiple sets of data. If, for example,you need a chart to show the number of sales by customer by country, in a visuallydynamic and relational format, you might consider using the 3-D Surface chart.

XY Scatter

An XY Scatter chart is a collection of plotted points that represent specific data in apool of information. The XY Scatter chart allows the user to consider a larger scopeof data for the purpose of determining trends. For example, if you input customerinformation, including sales, products, countries, months, and years, you wouldhave a collective of plotted points that represents the pool of customer information.Viewing all of this data on an XY Scatter chart would allow you to speculate as towhy certain products were selling better than others or why certain regions werepurchasing more than others.

Radar

A radar chart positions group data, such as countries or customers, at the perimeterof the radar. The radar chart then places numeric values, increasing in value, fromthe center of the radar to the perimeter. Radar charts are particularly useful fordetermining how specific values relate to group data.

Bubble

A bubble chart (an extension of the XY Scatter chart type) displays data as a series ofbubbles, where the size of the bubble is proportional to the amount of data. A bubblechart would be very effective with the number of products sold in a certain region; thelarger the bubble, the greater the number of products sold in that region.

Numeric Axis

A numeric axis chart is a bar, line, or area chart that uses a numeric object or adate/time object as its "Category (X) Axis" object. Numeric axis charts provide away of scaling your X-axis values, thus creating a true numeric X-axis or a truedate/time X-axis.

Gauge

A gauge chart presents values graphically as points on a gauge. Gauge charts, likepie charts, are typically used for one group of data (for example, the percentage ofsales for the entire inventory).

Gantt

A Gantt chart is a horizontal bar chart often used to provide a graphical illustration ofa schedule. The horizontal axis shows a time span, while the vertical axis shows aseries of tasks or events. Horizontal bars on the chart represent event sequences and

272 © 2011 SAP AG. All rights reserved. 2011

Page 299: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Charting Concepts

time spans for each item on the vertical axis. You should use only date objects whencreating a Gantt chart. The Chart Group Type should be set to "For Each Record", andthe start-and end-date objects should be added to the "Total (Y)" area of the chart.

Funnel

Funnel charts are often used to represent stages in a sales process. For example, theamount of potential revenue shown for each stage. This type of chart can also helpidentify potential problem areas in an organization's sales processes. A funnel chart issimilar to a stacked bar chart in that it represents 100% of the summary values forthe groups included in the chart.

Histogramm

A histogram is a type of bar chart used to depict how measurements vary from themean value. It can help identify the cause of problems in a process by the shape of thedistribution as well as the width (deviation) of the distribution. In a histogram, thefrequency is represented by the area of a bar rather than the height of the bar.

Chart group typesEach combination of chart type, subtype, and chart group type has a different set ofrequired objects. A subset of the following chart group types apply to each chart type:

• For each record• On change of• For all records

Once you have defined your chart type, subtype, and chart group type, you must adddata to one or more of the following values:

• Category• Total• Series• Label

Note: Not all of the items are available for every chart type.

Total (Y)

The "Total" value indicates what information is summarized on your chart. Forexample, to create a chart showing last year's sales for your customers, the Last Year'sSales object would be the value.

Category (X)

2011 © 2011 SAP AG. All rights reserved. 273

Page 300: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10: Charting BOCE10

The "Category" value is used with the chart group type "On Change of". It is used toindicate when to plot the point.

For example, a chart showing Last Year's Sales for your customers uses theCUSTOMER_NAME object as the condition. Each time the category changes (thecustomer name changes), a point is plotted.

Series (Z)

The "Series" value is used with the chart group type "On Change of". It is used tospecify data for a series.

Label

The "Label" value is used with the chart group type "For each record". It is usedto display a label for the "Total" value.

Placing a chart in a reportThe placement of a chart determines which data is displayed and where it is printed.For example, a chart placed in the "Report Header" section includes the data for theentire report, while a chart that is placed in a "Group Header" or in a "Group Footer"section displays only the group specific data.

Note: If your report contains subreports, you can place charts in thosesubreports as well.

274 © 2011 SAP AG. All rights reserved. 2011

Page 301: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Charting Concepts

Lesson Summary

You should now be able to:• Insert and create a chart

2011 © 2011 SAP AG. All rights reserved. 275

Page 302: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10: Charting BOCE10

Lesson: Charting on grouped data

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Create a chart on grouped data

Business Example

Creating a chart on grouped dataSince charts are a good way to display summarized information, they are usuallybased on a summary object in your report. You can create a chart based on values inthe Report Header or Footer, a Group Header or Footer, or a Cross-Tab summary.

Note: In an OLAP data source, if a measure is defined as a delegated measure,it is recommended to use the delegated measure as a summary object.

276 © 2011 SAP AG. All rights reserved. 2011

Page 303: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Charting on grouped data

To create a chart

1. From the "Insert" tab, click Chart and then select a chart type and subtype.Choose the chart type that best illustrates your data.

2. Drag the element frame to the area of the report canvas where you want to insertthe chart. Charts can be inserted in the Report Header or Footer, or in a GroupHeader or Footer.

3. On the default chart, click the Data tab.4. Drag objects from the "Data Explorer" panel onto the "Total", "Category", and

"Series" drop zones to add them to the chart.

Each drop zone represents an axis on the chart. The "Total" drop zone representsthe Y axis, the "Category" drop zone represents the X axis, and the "Series"drop zone represents the Z axis.

Each chart type and chart subtype has different required objects. For informationon which objects are required for each chart type and subtype.

Note:

• If there is a red outline around an object, then a value must beplaced there. When you move the cursor over the object, youwill see a note specifying how many parameters are required forthe object.

• When you add a value to either the "Category" or the "Series" area,the red outline may disappear from both areas.

5. Right-click the chart and click Format Chart.6. In the Format dialog box, click General to edit the title, position, and size of

the chart.7. Click Appearance to edit the formatting of the chart.8. To edit other elements on the chart, such as the axis labels, right-click the

element on the chart, and edit it using the format dialog box.

Note: When your chart is inserted, it may cover a portion of the report. Moveand resize the chart so that it fits properly within the report.

2011 © 2011 SAP AG. All rights reserved. 277

Page 304: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10: Charting BOCE10

Drill down on a chartCharting is not only a means of presenting data: it is also an analysis tool. Move yourcursor over a section of the chart in the "Page" mode, so that the pointer becomes adrill-down cursor, and then double-click to view the details for that section of the chart.

Note: Drill down on charts only works with grouped data, that includedetailed data on a lower level. The section the detailed data are placed in isusually formatted with “Show on Drill down only”.

278 © 2011 SAP AG. All rights reserved. 2011

Page 305: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Charting on grouped data

Exercise 24: Charting on grouped data

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task 1: Create a report with grouped dataGroup Order Amounts by Year using a group based on Order Date.

1. Create a new report that includes the following objects: Order ID, Order Date,Order Amount

2. Create a new query based on the Xtremeplus_CR Universe including OrderID, Order Date Order Amount.

3. Insert a group based on the Order Date and set the group options to be displayedby year.

4. Insert a Subtotal for Order Amount and place it in the Group Header.

Task 2: Insert a chart into the reportInsert a bar chart named “Order Amounts per Year” in the Report Header.

1. Insert a bar chart into the Report Header.

2. Make a few modifications to your chart. Select the chart, go to the Data tab andenable the title and go back to Show Chart.

3. Drill down on your chart.

4. Save your report as Charting on grouped data.

2011 © 2011 SAP AG. All rights reserved. 279

Page 306: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10: Charting BOCE10

Solution 24: Charting on grouped dataTask 1: Create a report with grouped dataGroup Order Amounts by Year using a group based on Order Date.

1. Create a new report that includes the following objects: Order ID, Order Date,Order Amount

a) Start -> Programs -> Crystal Reports for Enterprise

b) From the start page click Blank Report.

c) Logon to SAP Business Objects Enterprise if not already done.

d) Choose the Xtremeplus_cr universe as your data source.

2. Create a new query based on the Xtremeplus_CR Universe including OrderID, Order Date Order Amount.

a) Use the following objects as result objects in your query:

Order ID, Order Date, Order Amount

b) Click Finish.

c) View your report in Page Mode.

3. Insert a group based on the Order Date and set the group options to be displayedby year.

a) View your report in Structure Mode.

b) On the Data tab click on Groups. Click New

c) Select the Order Date object.

d) Select Subdivide by “Every Year”.

e) Click OK.

f) Delete the Order Date column.

g) Shrink the Group Header section.

h) Right click the Group Name and choose Format Group Name Element ... .

i) In the Group Name dialog open the Format folder on the left side andselect Date.

j) For the Year set the Format: 1999. Click Close.

k) View your report in Page Mode and make adjustments if necessary.Continued on next page

280 © 2011 SAP AG. All rights reserved. 2011

Page 307: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Charting on grouped data

4. Insert a Subtotal for Order Amount and place it in the Group Header.

a) Right click the Order Amount object in the Body section and choose TotalOrder Amount ...

b) In the following dialog box keep Sum of from the list of available functions.

c) Select For each grouping of order date.

d) Choose “Location: above data” and click Insert.

e) Hide the Group Footer by right-clicking it and choose Hide.

f) Right click the Body section and select Format Body from the resultingmenu.

g) In the Format section dialog mark General on the left side and check the“Show on drill only” Option. Click Close.

Task 2: Insert a chart into the reportInsert a bar chart named “Order Amounts per Year” in the Report Header.

1. Insert a bar chart into the Report Header.

a) View your report in Structure Mode.

b) On the Insert tab click Chart and then select Side-by-Side Bar chart.

c) Drag the element frame to the Report Header. If the Report Header is tosmall it will be enlarged automatically.

d) On the default chart [the placeholder, that represents the chart] click theData tab.

e) Drag the Order Date object to the “Category (X)” drop zone.

f) Right Click the Order Date Object in the drop zone and choose FormatChart Data ....

g) In the following dialog in the group section select Subdivide by: “EveryYear”. Click Close.

h) Drag the Order Amount object to the “Total (Y)” drop zone.

i) View your report in Page Mode.

Continued on next page

2011 © 2011 SAP AG. All rights reserved. 281

Page 308: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10: Charting BOCE10

2. Make a few modifications to your chart. Select the chart, go to the Data tab andenable the title and go back to Show Chart.

a) Double-Click the title of the chart and enter: “Order Amounts per Year”.

b) Right Click the chart and choose Format Chart...

c) In the Format Chart dialog mark Chart on the left side, uncheck “ShowLegend” and then click Close.

d) Select one of the bars, right-click and then choose Format Series0.

e) In the Format series dialog select Color Mode: “Color by Category”. ClickClose. Now the bars show different colors for the different years .

3. Drill down on your chart.

a) Double-Click a bar to show the hidden section.

b) The detail data are displayed on a new page.

c) Navigate back from the Detail View to the Chart View by using theDrilldown path on top of Crystal Reports..

4. Save your report as Charting on grouped data.

a) Save your report in your My Favorites.

282 © 2011 SAP AG. All rights reserved. 2011

Page 309: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Charting on grouped data

Lesson Summary

You should now be able to:• Create a chart on grouped data

2011 © 2011 SAP AG. All rights reserved. 283

Page 310: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10: Charting BOCE10

Lesson: Creating a chart on detailed data

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Create a chart on detailed data

Business Example

Creating a chart on detailed dataCharts can be inserted in reports that have grouped data and also in reports that do nothave grouped data. Data that are nor grouped are called detailed data in this context.

When working with a report that contains detailed data only but also shall includegrouped data in a chart, grouping can be done within the chart panel. In order to dothis you right click an object in the Category (X) or the Series (Z) drop zone andchoose Format Chart Data... . In this dialog you can define Grouping Options. Thisway your are not dependent on grouped data in the report.

Creating a chart in a report with detailed data follows the same steps as building achart on grouped data. But there is one thing you can not do, when the report itselfcontains detailed data only. You can not drill down on the data. In case you have areport with grouped data and the detailed section prepared for Drill Down you willbe able to doubleclick an element of the chart to drill down. But with a report thatcontains detailed data only this can not be done.

284 © 2011 SAP AG. All rights reserved. 2011

Page 311: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Creating a chart on detailed data

Exercise 25: Charting on detailed data

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Create a chart on detailed dataInsert a 3D-Pie Chart to show Last Year’s Sales per Customer. Place the chart inthe Report Header section. The legend should display the percentage of last year’ssales on the left side of the report.

1. Open the Charting-1.rpt report.

2. Insert a 3D-Pie Chart in the report and show the Legend on the left side.

3. Save your report as Charting on detailed data.

2011 © 2011 SAP AG. All rights reserved. 285

Page 312: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10: Charting BOCE10

Solution 25: Charting on detailed dataTask: Create a chart on detailed dataInsert a 3D-Pie Chart to show Last Year’s Sales per Customer. Place the chart inthe Report Header section. The legend should display the percentage of last year’ssales on the left side of the report.

1. Open the Charting-1.rpt report.

a) Open the local Charting-1.rpt report using the following menu path:File -> Open a Local File -> My Documents -> BOEC10 -> Unit10 ->Charting-1.rpt

2. Insert a 3D-Pie Chart in the report and show the Legend on the left side.

a) View the report in Structure Mode.

b) Enlarge the Report Header, so that there is enough space to place the chart.

c) On the Insert tab click Chart and then select Pie chart.

d) Drag the element frame to the Report Header. If the Report Header is toosmall it will be enlarged automatically.

e) On the default chart [the palceholder, that represents the chart] click theData tab.

f) Drag the Customer Name object to the Series (Z) drop zone.

g) Drag the Last Year's Sales object to the Total (Y) drop zone.

h) Right click the chart and choose Format Chart.

i) Select Depth on the left side of the Format Chart dialog an check the“Enable Depth Effect” Option. Click Close and go to Page Mode.

j) Select the legend, right-click and choose Format Legend....

k) Select Layout: “Legend on Left Side.” Click Close.

l) Resize the chart if necessary.

3. Save your report as Charting on detailed data.

a) Save your report as Charting on detailed data in your My Favorites.

286 © 2011 SAP AG. All rights reserved. 2011

Page 313: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Creating a chart on detailed data

Lesson Summary

You should now be able to:• Create a chart on detailed data

2011 © 2011 SAP AG. All rights reserved. 287

Page 314: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10: Charting BOCE10

Lesson: Formatting Charts

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Get to know the formatting options of a chart• Apply formatting options to a chart

Business Example

Format a Chart (Chart, General, Appearance, Depth)Once you have created a chart, you may want to add a new title, headings, or a legend,change fonts, or even change the type of chart. Crystal Reports provides many optionsfor working with your existing charts.

You can modify the fonts and text of the titles on the chart, modify the legend format,modify the gridlines when they are used, and more. The following sections provideinformation on some of the formatting options.

Editing charts

You can modify many of your original choices, such as the type of chart to display, thedata on which the chart is based, and so on. When you change the type of chart, youmay need to select new object values to use for the chart.

288 © 2011 SAP AG. All rights reserved. 2011

Page 315: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Charts

To edit a chart using the Format dialog box

1. Right-click the element of the chart you want to edit, such as the title, a textobject, or the chart itself, and click Format [object name].[object name] is thename of the object you are formatting. For example, "Format Frame", "FormatTitle", "Format X Axis Title", and so on.The Format dialog box appears.

Note: The currently selected element is shown in the Selected Elementmenu. To edit a different element, choose the element from the menu orclick it on the chart.

2. Make the desired changes.3. Click Close to apply the formatting changes.

To change the chart's title

1. Double-click the title on the chart.2. Enter a new title in the text box.

Note: To change the font properties, use the options on the "Format"toolbar.

To change the chart's legend format

1. Right-click the legend on the chart and then click Format Legend.2. Use the properties to change the appearance, font, or other options for the legend.

To change the border of a chart

1. Right-click the chart and click Format Chart.2. From the "Selected Element" list, click Frame. The "Appearance" section

appears.3. In the "Border" area, change the border line style or color.

To change the background of a chart

1. Right-click the chart and click Format Chart.2. From the "Selected Element" list, click Frame. The "Appearance" section

appears.3. In the "Fill" area, use the "Color" list to change the background color of the cart.

2011 © 2011 SAP AG. All rights reserved. 289

Page 316: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10: Charting BOCE10

Format Chart Elements (Axes, Series)To change axis options

1. Right-click the axis and click Format [x, y,z] Axes.2. In the dialog box, use the appropriate sections to change gridlines, the axis

location, the color and line style of your axis, and so on.3. Click Close to apply the formatting changes.

To change series options

1. Right-click a riser item (area, bar, line, marker, pie slice, and so on) or a legendmarker on the chart, and click Format [object name]. [object name] is the nameassigned to the object that you selected.

2. In the dialog box, make the desired changes.3. Click Close to apply the formatting changes.

Using the Chart Hightlighting ExpertThe Chart Highlighting Expert offers you possibilities to conditionally highlight achart. You can define one or more conditions and assign a color to each conditionthat is applied when the condition met.

To conditionally format a chart

1. Right-click the chart and click Chart Highlighting Expert. The "ChartHighlighting Expert" dialog box appears.

2. Click Add Condition to add a new condition.3. Using the menus, set the formula conditions and choose a display color.4. Repeat steps 2 and 3 for any other conditions you want to add to your chart.5. Click OK.

The values specified by your condition are displayed in the color you selected.

Note:

• Conditional formatting is not available for every chart type.• An area chart must have both Category and Series values for conditional

formatting to appear.• If your chart type is line, the chart must have data markers before you

can see conditional formatting.

290 © 2011 SAP AG. All rights reserved. 2011

Page 317: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Charts

Exercise 26: Customizing a chart

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Format a chart using Chart OptionsUsing Chart Options, expand the pie depth to 75, show the slices as separated by20%, show a border around the legend

1. Open the Charting on detailed data report.

2. Increase the pie depth to 75.

3. Separate the pie slices from each other by 20%.

4. Show a border around the legend.

5. Save your report as Customizing a chart.

2011 © 2011 SAP AG. All rights reserved. 291

Page 318: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 10: Charting BOCE10

Solution 26: Customizing a chartTask: Format a chart using Chart OptionsUsing Chart Options, expand the pie depth to 75, show the slices as separated by20%, show a border around the legend

1. Open the Charting on detailed data report.

a) Open the Charting on detailed data report from your My Favorites.

2. Increase the pie depth to 75.

a) Right-click the chart and choose Edit chart type ....

b) In the following dialog mark Depth on the left side.

c) For “Pie Depth:” enter the value “35” .

d) Stay in this dialog.

3. Separate the pie slices from each other by 20%.

a) For “Explode:” enter the value “20”.

b) Click Close.

4. Show a border around the legend.

a) Right click the Legend and choose Format Legend....

b) On the following dialog select “Appearance” on the left side.

c) For “Style” select “Single Line Frame”. Click Close.

d) View your report in Page Mode and make adjustments if necessary.

5. Save your report as Customizing a chart.

a) Save the report as Customizing a chart in your My Favorites.

292 © 2011 SAP AG. All rights reserved. 2011

Page 319: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Formatting Charts

Lesson Summary

You should now be able to:• Get to know the formatting options of a chart• Apply formatting options to a chart

2011 © 2011 SAP AG. All rights reserved. 293

Page 320: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

Unit SummaryYou should now be able to:• Insert and create a chart• Create a chart on grouped data• Create a chart on detailed data• Get to know the formatting options of a chart• Apply formatting options to a chart

294 © 2011 SAP AG. All rights reserved. 2011

Page 321: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Test Your Knowledge

Test Your Knowledge

2011 © 2011 SAP AG. All rights reserved. 295

Page 322: BOCE10 - Crystal Reports - Fundamentals of Report Design

Test Your Knowledge BOCE10

Answers

296 © 2011 SAP AG. All rights reserved. 2011

Page 323: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 324: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 325: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

297 © 2011 SAP AG. All rights reserved. 2011

Page 326: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

298 © 2011 SAP AG. All rights reserved. 2011

Page 327: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 11Distributing Reports

Unit Overview[Enter a brief overview of the unit.]

Unit ObjectivesAfter completing this unit, you will be able to:

• Get to know the exporting formats, options and destinations for a report• Define viewing requirements in SAP BusinessObjects Business Intelligence

Platform• Save a report to an SAP Business Objects Enterprise Folder

Unit ContentsLesson: Exporting a report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .300

Exercise 27: Exporting a report to Microsoft Excel . . . . . . . . . . . . . . . . . . . . . . . .305Exercise 28: Exporting a report to Microsoft Word... . . . . . . . . . . . . . . . . . . . . . .307

Lesson: Saving to SAP BusinessObjects Business Intelligence Platform...310

2011 © 2011 SAP AG. All rights reserved. 299

Page 328: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 11: Distributing Reports BOCE10

Lesson: Exporting a report

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Get to know the exporting formats, options and destinations for a report

Business Example

Exporting reportsFinished reports can be exported to a number of popular formats, such as XML, PDF,HTML, spreadsheets and word processing, and other common data interchangeformats. This makes the distribution of information easier. For example, you maywant to use the report data to enhance the presentation of data in a desktop publishingpackage. The exporting process requires you to specify an export forma.

To export a report

1. While in the "Page" mode, click File > Export and select an export format fromthe list. The" Export Options" dialog box appears.

2. Select the export options.3. Click OK.4. In the "Export Destination" dialog box, do one of the following:

• Click To File and enter the report title to save the exported report in the"Export Report" dialog box.

• Click To Application to open the report in the selected application withoutsaving it.

Exporting formatsThe export formats supported by Crystal Reports can be broadly categorized in twogroups: Page-based Formats and Record-based Formats.

Page-based formats tend to produce a more exact output. The emphasis of theseformats is structure representation and formatting. Formatting refers to attributes suchas font style, text color, text alignment, background color, and so on. Structure refersto element position, element size, and the relationship between these attributes and

300 © 2011 SAP AG. All rights reserved. 2011

Page 329: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Exporting a report

other elements. Depending on the format you choose, it may not be possible for theprogram to preserve all structure and formatting perfectly, but page-based formats, ingeneral, preserve these properties as closely as possible.

With Record-based formats, the emphasis is on data rather than the structure andformatting. However, in some formats you will notice that some formatting isexported. Some of the record-based formats are only data-exchange formats.

Here is an Export Formats Overview about the available export formats in CrystalReports for Enterprise:

• Microsoft Excel (97–2003) Data-only• Microsoft Excel (97–2003)• Microsoft Excel Workbook Data-only• Microsoft Word (97–2003)• Microsoft Word (97–2003) - Editable• PDF• Separated Values (CSV)• Rich Text Format (RTF)• Export to Report Definition• XML• Plain Text• Tab-separated text (TTX)• HTML 4.0

Exporting a report to application formatsMicrosoft Excel (97–2003) Data-only

Microsoft Excel (97-2003) Data-Only is a record-based format that concentrates ondata. This format does export most of the formatting, however, it does not mergecells; each element is added to only one cell. This format can also export certainkinds of summaries as Excel functions. The summaries that are supported are SUM,AVERAGE, COUNT, MIN and MAX.

Microsoft Excel (97–2003)

Microsoft Excel (97-2003) page-based format converts your report contents into Excelcells 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, theexport program creates multiple worksheets to accommodate the data. If a reportelement covers more than one cell, the export program merges cells to represent areport element. Microsoft Excel has a limit of 256 columns in a worksheet; therefore,

2011 © 2011 SAP AG. All rights reserved. 301

Page 330: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 11: Distributing Reports BOCE10

any report element (or part of it) that is added to cells beyond 256 columns is notexported. This export format retains most of the formatting, but it does not exportline and box elements from your report.

Microsoft Excel Workbook Data-only

Microsoft Excel Workbook Data-Only is a record based format that concentrates ondata as well. This exporting format is an enhancement on the existing MicrosoftExcel Workbook Data-Only exporting type. The exported result of this format is anXLSX file. XSLX file format is an XML based open document format introduced andsupported by Microsoft Excel 2007 and later.

Microsoft Word (97–2003)

The Microsoft Word (RTF) format is a page-based format, but not all of the report'sstructure and formatting options are preserved in the output. Microsoft Word is apage-based, exact format that produces an RTF (Rich Text Format) file. The exportedfile contains text and drawing objects to represent report objects. Individual objectsare placed in text frames. This format is intended for use in applications such asfill-out forms where the space for entering text is reserved as empty text objects.Almost all of the formatting is retained in this export format.

Microsoft Word (97-2003) Editable

The Microsoft Word - Editable format is different from the Microsoft Word format;it is a page-based format, but not all of the layout and formatting properties arepreserved in the output. This format converts all of the report object contents to textlines. Unlike Microsoft Word format, this format does not use text frames. Textformatting is retained, but attributes such as background color and fill pattern maynot be retained. All of the images in your report are inlined with the textual content.Therefore, the images automatically shift to accommodate the text when the documentis edited in Microsoft Word. This format does not export line and box objects fromyour report. Also, the Predefined Objects: Page Number and Page N of M do not workwhen exported in this format. The Microsoft Word - Editable format has an optionto insert page breaks at the end of each report page. This option may not correspondto the page breaks created by Microsoft Word; the option is used mainly to separateyour report-page contents.

PDF

Adobe Reader format is a page-based format. The exported documents are intendedfor printing and redistribution. Acrobat format will export both structure andformatting in a manner that is consistent with how the report looks on the Page tab.This exporting format gives you the option to create bookmarks from the grouptree. Acrobat format embeds the TrueType fonts that appear in the document.(Non-TrueType fonts are not supported.) This export format does not supportMicrosoft font-linking technology—which is used to provide support for some

302 © 2011 SAP AG. All rights reserved. 2011

Page 331: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Exporting a report

extended character sets such as Chinese HKCS. Therefore, the fonts used in the reportmust contain all of the required glyphs. These URI types are supported for hyperlinks:"http:", "https:" and "mailto:"

Separated Values (CSV)

The Character-Separated Values (CSV) format is a record-based, data-exchangeformat. It exports the report element contents as a set of values separated by a comma.Like record-style formats, the CSV format also creates one line of values for eachrecord in your report. A record contains all of the elements in each section of yourreport as seen in the "Structure" mode. That is, elements in the "Report Header"section are exported first, followed by the "Page Header" section, the "Group Header"section, the "Body" section, the "Group Footer" section, the "Report Footer" section,and finally, the "Page Footer" section.

Rich Text Format (RTF)

The Rich Text Format (RTF) format is similar to the Microsoft Word (RTF) format.

Export to Report Definition

The Report Definition format exports your report to a text file that contains a briefdescription of the report's design view. This document is quite useful for studyingand analyzing the structure of a report.

XML

XML is used primarily for data exchange. It is a record-based format that uses theCrystal XML Schema. The XML Expert in Crystal Reports can be used to customizethe XML output.

Plain Text

Plain Text (Page Based) Text format is a page-based format in SAP Crystal Reportsfor Enterprise. It's different from the Text exporting format in Crystal Reports 2011,which is a record based exporting format.

Tab-separated text (TTX)

The Tab Separated Text (Page Based) format is similar to the Plain Text (Page Based)format. It is also a page-based exporting format, different from the Tab SeparatedText exporting format in Crystal Reports 2011, which is record-based. TTX files canbe opened in Microsoft Excel.

HTML 4.0

HTML export formats are page based. The HTML 4.0 format preserves the layout andformatting of the report by using DHTML.

2011 © 2011 SAP AG. All rights reserved. 303

Page 332: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 11: Distributing Reports BOCE10

You will find additional information about export options related to single exportformats in the Crystal Reports for Enterprise Help.

304 © 2011 SAP AG. All rights reserved. 2011

Page 333: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Exporting a report

Exercise 27: Exporting a report to MicrosoftExcel

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Export to Excel and Excel Data onlyExport the report to Microsoft Excel (97-2003) and to Excel (Data Only).

1. Open the Exporting Report-1.rpt report.

2. Export the report to Microsoft Excel. Ensure that there are page breaks and pageheaders for each page. Convert the order date to be displayed as a string.

3. Export the same report again. This time select the Microsoft Excel (Data Only)format. Ensure that the Xtreme logo is also exported.

2011 © 2011 SAP AG. All rights reserved. 305

Page 334: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 11: Distributing Reports BOCE10

Solution 27: Exporting a report to MicrosoftExcelTask: Export to Excel and Excel Data onlyExport the report to Microsoft Excel (97-2003) and to Excel (Data Only).

1. Open the Exporting Report-1.rpt report.

a) Open the Exporting Report-1.rpt report using the following menupath: File -> Open a Local File -> My Documents -> BOCE10 ->Activity_Resources ->Unit11 -> Exporting Report-1.rpt

2. Export the report to Microsoft Excel. Ensure that there are page breaks and pageheaders for each page. Convert the order date to be displayed as a string.

a) Click File -> Export -> Microsoft Excel (97-2003).

b) In Excel Format Options, specify on each page for Export page headersand footers.

c) Select the “Create page breaks for each page” checkbox.

d) Select the “Convert date values to strings” checkbox.

e) Click OK.

f) When asked about Destination click To Application.

g) View your exported results.

h) Save the output as Exporting to Excel.xlsx in your My Documents folder.

3. Export the same report again. This time select the Microsoft Excel (Data Only)format. Ensure that the Xtreme logo is also exported.

a) Click File -> Export -> Microsoft Excel (97-2003) Data only.

b) In Excel Format Options, select “Custom: Data is exported accordingto selected options.”

c) Click Options.

d) Select the “Export element formatting” checkbox.

e) When asked about Destination click To Application.

f) View your exported results.

g) Save the output as Exporting to Excel Data only.xlsx in your MyDocuments folder. Close Excel.

306 © 2011 SAP AG. All rights reserved. 2011

Page 335: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Exporting a report

Exercise 28: Exporting a report to MicrosoftWord

Exercise ObjectivesAfter completing this exercise, you will be able to:• [Enter an exercise objective. Insert additional objectives if required.]

Business Example[Enter a business example that helps the learner understand the practical businessuse of this exercise.]

Task: Export to Word and Word - EditableExport a report to Microsoft word.

1. Open the Exporting Report-1.rpt report.

2. Export the report to Word.

3. Export the same report again. This time select Word - Editable.

2011 © 2011 SAP AG. All rights reserved. 307

Page 336: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 11: Distributing Reports BOCE10

Solution 28: Exporting a report to MicrosoftWordTask: Export to Word and Word - EditableExport a report to Microsoft word.

1. Open the Exporting Report-1.rpt report.

a) Open the Exporting Report-1.rpt report using the following menu path.File -> Open a Local File -> My Documents -> BOCE10 -> Unit 11 ->Exporting Report-1.rpt .

2. Export the report to Word.

a) Click File -> Export -> Microsoft Word (97 - 2003)

b) Accept the default export options.

c) Click OK.

d) When asked about Destination click To Application.

e) View your exported results.

f) Save the output as Exporting to Word.docx in your My Documentsfolder. Close Word.

3. Export the same report again. This time select Word - Editable.

a) Click File -> Export -> Microsoft Word (97 - 2003) - Editable.

b) As an export option, select the Insert page break after each report pagecheckbox.

c) Click OK.

d) When asked about Destination click To Application.

e) View your exported results.

f) Save the output as Exporting to Word - Editable.docx in your MyDocuments folder. Close Word.

308 © 2011 SAP AG. All rights reserved. 2011

Page 337: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Exporting a report

Lesson Summary

You should now be able to:• Get to know the exporting formats, options and destinations for a report

2011 © 2011 SAP AG. All rights reserved. 309

Page 338: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 11: Distributing Reports BOCE10

Lesson: Saving to SAP BusinessObjects BusinessIntelligence Platform

Lesson Overview[Enter a brief overview of the lesson.]

Lesson ObjectivesAfter completing this lesson, you will be able to:

• Define viewing requirements in SAP BusinessObjects Business IntelligencePlatform

• Save a report to an SAP Business Objects Enterprise Folder

Business Example

Publishing a report to SAP BusinessObjects BusinessIntelligence PlatformAfter designing a report you might want to publish it. One way to distribute yourreports is through SAP BusinessObjects Enterprise. You can choose betweenpublishing the report to one of your personal folders or to a public folder. Dependingon their rights other user can see and refresh the reports that you have published.

To publish a report to SAP BusinessObjects Enterprise

1. If you are not already logged on to BusinessObjects Enterprise, click File >Log On to SAP BusinessObjects Enterprise, enter your connection information,and then click OK.

2. Click File > Save.3. In the "Save Report to [Server Name]" dialog box, navigate to the location that

you want to save your report to.4. Type a display name in the Display Name box.5. Click Save.

A dialog box appears with a message that your report has been successfully publishedto SAP BusinessObjects Enterprise.

310 © 2011 SAP AG. All rights reserved. 2011

Page 339: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Lesson: Saving to SAP BusinessObjects Business Intelligence Platform

Reports that have been saved to the SAP BusinessObjects BI platform can be accesedby working with the BI Launchpad. In order to use it you have to log on to SAPBusinessObjects BI platform. What a users get's to see depends on the access rights hehas been granted.

Within the Launchpad you have additional possibilities beside viewing likeScheduling, Distributing and Exporting of reports. Enterprise functionalities andEnterprise Administration will be explained in our BOE Enterprise courses.

2011 © 2011 SAP AG. All rights reserved. 311

Page 340: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit 11: Distributing Reports BOCE10

Lesson Summary

You should now be able to:• Define viewing requirements in SAP BusinessObjects Business Intelligence

Platform• Save a report to an SAP Business Objects Enterprise Folder

312 © 2011 SAP AG. All rights reserved. 2011

Page 341: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Unit Summary

Unit SummaryYou should now be able to:• Get to know the exporting formats, options and destinations for a report• Define viewing requirements in SAP BusinessObjects Business Intelligence

Platform• Save a report to an SAP Business Objects Enterprise Folder

2011 © 2011 SAP AG. All rights reserved. 313

Page 342: BOCE10 - Crystal Reports - Fundamentals of Report Design

Unit Summary BOCE10

314 © 2011 SAP AG. All rights reserved. 2011

Page 343: BOCE10 - Crystal Reports - Fundamentals of Report Design

BOCE10 Test Your Knowledge

Test Your Knowledge

2011 © 2011 SAP AG. All rights reserved. 315

Page 344: BOCE10 - Crystal Reports - Fundamentals of Report Design

Test Your Knowledge BOCE10

Answers

316 © 2011 SAP AG. All rights reserved. 2011

Page 345: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 346: BOCE10 - Crystal Reports - Fundamentals of Report Design
Page 347: BOCE10 - Crystal Reports - Fundamentals of Report Design

Test Your Knowledge BOCE10

317 © 2011 SAP AG. All rights reserved. 2011

Page 348: BOCE10 - Crystal Reports - Fundamentals of Report Design

Course Summary BOCE10

Course SummaryYou should now be able to:

• Create, modify and enhance a Crystal Report

318 © 2011 SAP AG. All rights reserved. 2011

Page 349: BOCE10 - Crystal Reports - Fundamentals of Report Design

FeedbackSAP AG has made every effort in the preparation of this course to ensure the accuracyand completeness of the materials. If you have any corrections or suggestions forimprovement, please record them in the appropriate place in the course evaluation.

2011 © 2011 SAP AG. All rights reserved. 319