You are on page 1of 82

Crystal Reports XI

Essentials for New Users


Alan Mayer, Integra Solutions
Crystal Reports XI …
The Marriage of Reporter and Designer!

Slide 3
Our Figureheads

BusinessObjects Reporter
(now Desktop Intelligence in XI R2)

BusinessObjects Designer

Slide 4
Topics

Getting started
Retrieving data
The Crystal Reports model
Formatting
Grouping and sorting
Formulas
Parameters
Multi-pass reporting
Q&A

Slide 5
Getting Started 1/2

Crystal starts without logging in


ƒ Login usually required to access data
ƒ Enterprise-based content is secured
ƒ No way to restrict most Crystal Reports functionality

Slide 6
Getting Started 2/2

Users can choose blank or wizard-driven reports


ƒ Wizards help with a particular type of report
ƒ Blank reports are built from scratch

Slide 7
Topics

Getting started
Retrieving data
The Crystal Reports model
Formatting
Grouping and sorting
Formulas
Parameters
Multi-pass reporting
Q&A

Slide 8
Retrieving Data 1/15

The source of data is chosen first


ƒ Crystal has more potential sources to choose from
ƒ Native drivers are available for Oracle, DB2, …

Slide 9
Retrieving Data 2/15

Choose a data source then establish the connection


ƒ Similar to establishing a connection to a universe
ƒ Not as many options for controlling the connection

Slide 10
Retrieving Data 3/15

Once the connection is set,


data objects can be retrieved
ƒ Works like the BusinessObjects Designer
table browser
ƒ Options can alter the objects displayed
(right-click on list)

Slide 11
Retrieving Data 4/15

Select tables and views to report on

Slide 12
Retrieving Data 5/15

Crystal automatically links the tables by default


ƒ This feature can be turned off
ƒ Links are created based on field name or index, data type, and data
format
ƒ Links can be manually created (traced)
ƒ Similar to BusinessObjects Designer join strategies

Slide 13
Retrieving Data 6/15

Use Link Options for fine-tuning


ƒ Change inner joins to outer joins
ƒ Change relationships (other than equal)
ƒ Enforcing Joins similar to implicating joins in Designer (Table button)
ƒ Cardinalities not necessary – no loops

Slide 14
Retrieving Data 7/15

End of the road for a blank report


ƒ No fields (or data) is displayed
ƒ The Field Explorer can be used to select report fields

The Database Expert returns you


to any previously selected options

Slide 15
Retrieving Data 8/15

The Standard Report Wizard asks additional questions


ƒ Report fields can be added
ƒ Breaks (groups) can be defined
ƒ Totals can be added
ƒ Predefined templates may also be selected

Slide 16
Retrieving Data 9/15

The Report Wizard’s final result:


ƒ A report with data!

HEY!

Slide 17
Retrieving Data 10/15

A report without conditions?


Traditional BusinessObjects users add conditions
within the Query Panel
Crystal users add conditions through the Select Expert

Slide 18
Retrieving Data 11/15
The Select Expert

The Select Expert adds one or more conditions to the


query
It acts like the condition panel within a traditional
BusinessObjects query

Slide 19
Retrieving Data 12/15
The Select Expert

The Select Expert initially has no conditions


Select the New tab or button to start a condition

Slide 20
Retrieving Data 13/15
The Select Expert, cont’d

Choose a field from the tables previously selected


ƒ The field you select does not have to be displayed in the report
ƒ Don’t find the field you need?
Add more tables using the Database Expert

Slide 21
Retrieving Data 14/15
The Select Expert, cont’d

Choose a comparison operator and operand

List of values is automatic!

Slide 22
Retrieving Data 15/15
The Select Expert, cont’d

The final condition:

More complicated record-selection conditions can be


created in the Formula Editor

Slide 23
Topics

Getting started
Retrieving data
The Crystal Reports model
Formatting
Grouping and sorting
Formulas
Parameters
Multi-pass reporting
Q&A

Slide 24
The Crystal Reports Model 1/3

BusinessObjects
Reporter characteristics
ƒ Multiple blocks per report
ƒ Blocks located anywhere
ƒ Multiple reports per
document
ƒ Frame-based

Slide 25
The Crystal Reports Model 2/3

Crystal Reports characteristics


ƒ One main report
ƒ Section-based (band-based)
ƒ Multiple tables per band
ƒ Sub-sections allowed

Slide 26
The Crystal Reports Model 3/3

Report header and report footer


ƒ Printed once per report
ƒ Used for report title
ƒ Also used for summary charts, tables
Page header and page footer
ƒ Printed top and bottom of every page
ƒ Column headings are commonly found in header
ƒ Page numbers found in footer
Details
ƒ Prints detailed information once per record
ƒ Field values found here

Slide 27
Topics

Getting started
Retrieving data
The Crystal Reports model
Formatting
Grouping and sorting
Formulas
Parameters
Multi-pass reporting
Q&A

Slide 28
Formatting 1/8
Placing fields
Drag fields from the Field Explorer to the Design window
ƒ One or more fields can be selected at a time
ƒ Drag one field at a time for precise placement

Slide 29
Formatting 2/8
Placing fields, cont’d
Position fields using guidelines
ƒ Fields are attached to nearest guideline
ƒ Moving the guideline moves the field
ƒ No similar technique in BO Reporter Guideline

Slide 30
Formatting 3/8
Placing fields, cont’d
Other alignment options are available
ƒ Like Reporter, Crystal offers Snap to Grid
ƒ Crystal does it with more precision
ƒ Individual fields/objects can be aligned
File \ Tools \ Layout

View \ Grid \ Design

Slide 31
Formatting 4/8
Formatting fields
The Field Formatter controls the format

Formats can be
conditionally applied

Super Alerter!

Slide 32
Formatting 5/8
Formatting sections
Format sections using the Section Expert

Slide 33
Formatting 6/8
Formatting sections, cont;d
Some (but not all) of these features are available
from the Reporter’s Map tab

Slide 34
Formatting 7/8
Using refreshed vs. saved data

Previewing your report the first time retrieves new data


from the data source
Crystal will only retrieve new data when necessary
ƒ New fields added to report or a formula on report
ƒ More records needed
ƒ Different conditions applied using Select Expert
Crystal may prompt you to choose between saved
(existing) and refreshed data
You can always force a refresh

Slide 35
Formatting 8/8
Previewing the report

Use the Print Preview button to view your report


You can make changes in the Preview window
ƒ Resizing columns, formatting fields, …
Most developers make changes in the Design tab

Slide 36
Topics

Getting started
Retrieving data
The Crystal Reports model
Formatting
Grouping and sorting
Formulas
Parameters
Multi-pass reporting
Q&A

Slide 37
Grouping and Sorting 1/10
Sorting

Use the Record Sort Expert to sort detail records


ƒ Adds an ORDER BY clause to the SQL query
ƒ Can sort on fields not included in the report

Query Sort

Slide 38
Grouping and Sorting 2/10
Previewing sorted results

The Preview tab shows the sorted records

Ascending Ascending Ascending Descending


(for ID)

Slide 39
Grouping and Sorting 3/10
Previewing sorted results, cont’d

The Preview tab may be several pages long


Use the navigation controls (upper right hand corner)
to move between pages

Slide 40
Grouping and Sorting 4/10
Grouping

Use the Insert Group button to group similar records


ƒ No limit to the number of groups added
ƒ Can order groups

Breaks

Slide 41
Grouping and Sorting 5/10
Grouping, cont’d

Options can be specified for a group


ƒ Fewer options than BusinessObjects Reporter
ƒ Most options available in different areas

Slide 42
Grouping and Sorting 6/10
Grouping, cont’d

Header and footer added after group is inserted


ƒ Group name added to header, nothing to footer

Slide 43
Grouping and Sorting 7/10
Grouping, cont’d

Group trees allow quick navigation


ƒ Like the navigation control of Report Manager

Slide 44
Grouping and Sorting 8/10
Adding totals

Use the Insert Summary button to add totals

Slice and Dice

Slide 45
Grouping and Sorting 9/10
Adding totals, cont’d

More calculations available!

Slide 46
Grouping and Sorting 10/10
Adding totals, cont’d
Location specified within window
ƒ BusinessObjects Reporter used calculation contexts

Create groups before summaries!

Slide 47
Topics

Getting started
Retrieving data
The Crystal Reports model
Formatting
Grouping and sorting
Formulas
Parameters
Multi-pass reporting
Q&A

Slide 48
Formulas 1/8

Use the Field Explorer or Formula Workshop to add


formulas
ƒ Formulas are another Crystal Reports “sweet spot”
ƒ More power … more features … more control!

Select Formula Fields


then New button

.. Or ..

Formula Workshop button

Slide 49
Formulas 2/8

Supply a name for the new formula


ƒ Named formulas are variables in BusinessObjects Reporter

I like variables!

Slide 50
Formulas 3/8

The Formula Editor should satisfy all audiences


ƒ Simple enough for the beginning user
ƒ Powerful enough for a programmer

Slide 51
Formulas 4/8

More functions are available!

Slide 52
Formulas 5/8

More operators to choose from!

Slide 53
Formulas 6/8

Formulas can be simple …

{Orders.Order Amount} * .175

No equal sign! Use braces to reference No leading zeros needed!


fields rather than < >

Slide 54
Formulas 7/8

To conditional …

if {Customer.Region} = "AL"
then {Orders.Order Amount} * .05 else
if {Customer.Region} = "AR"
then {Orders.Order Amount} * .075 else

Slide 55
Formulas 8/8

To procedural …
//Reverse a string version 1 Comments!
Local StringVar str := "";
Local NumberVar strLen := Length ({Customer.Customer Name});
Local NumberVar i;
For i := 1 To strLen Do
(
Local NumberVar charPos := strLen - i + 1;
str := str + {Customer.Customer Name}[charPos] Arrays!
);
str

Slide 56
Topics

Getting started
Retrieving data
The Crystal Reports model
Formatting
Grouping and sorting
Formulas
Parameters
Multi-pass reporting
Q&A

Slide 57
Parameters 1/16

Parameters act like prompts in BusinessObjects Reporter


ƒ Use the Field Explorer
Select Parameter Fields
then New button

@Prompt

Slide 58
Parameters 2/16
Static prompts
The New Parameter window will open

Slide 59
Parameters 3/16
Static prompts, cont’d
Add the parameter name and data type
Tell Crystal Reports where to retrieve the values
ƒ Specify a table field or
ƒ Add values manually or
ƒ Import values

Slide 60
Parameters 4/16
Static prompts, cont’d
We’ll add all possible database values
ƒ Once added, these values are static

Slide 61
Parameters 5/16
Static prompts, cont’d

Parameter options can now be filled in


ƒ Our current options: one value (mono)

Slide 62
Parameters 6/16
Static prompts, cont’d

The parameter can now be used in a SQL condition


ƒ Use the Select Expert
ƒ Modify the existing condition on Country
ƒ The new parameter should appear in the list

Slide 63
Parameters 7/16
Static prompts, cont’d

Crystal Reports will prompt for Country when this report


is refreshed

Slide 64
Parameters 8/16
Dynamic prompts

This approach creates independent prompts


Each prompt is not constrained by any other
A BusinessObjects report writer’s dream would be
cascading prompts
Each prompt would reflect previous prompt choices
This was possible (but not elegant) in Reporter
This feature has been added to Crystal Reports XI
Wanna see how?

Slide 65
Parameters 9/16
Dynamic prompts, cont’d
Create another parameter based on Region
ƒ Make its list of values dynamic

Slide 66
Parameters 10/16
Dynamic prompts, cont’d
Add a value based on Country
ƒ Select the Insert button
ƒ Choose Customer.Country

Slide 67
Parameters 11/16
Dynamic prompts, cont’d
Add a value based on Region
ƒ Select the Insert button again
ƒ Choose Customer.Region
ƒ Crystal Reports indents values in the direction they will cascade

Slide 68
Parameters 12/16
Dynamic prompts, cont’d
Two parameters are created to support the cascade
ƒ The Field Explorer show two new parameters

Slide 69
Parameters 13/16
Dynamic prompts, cont’d
Use the Select Expert to adjust the query
ƒ Replace the Country prompt with Region - Country

Slide 70
Parameters 14/16
Dynamic prompts, cont’d
Use the Select Expert to adjust the query
ƒ Create a new condition for Region based on Region - Region

Slide 71
Parameters 15/16
Dynamic prompts, cont’d
Refresh the query
ƒ Choose any country
ƒ The second prompt will reflect only regions of that country

Slide 72
Parameters 16/16
Dynamic prompts, cont’d
Try it again

Slide 73
Topics

Getting started
Retrieving data
The Crystal Reports model
Formatting
Grouping and sorting
Formulas
Parameters
Multi-pass reporting
Q&A

Slide 74
Multi-Pass Reporting 1/7

BusinessObjects Reporter is a single-pass report writer


Crystal Reports XI uses a three-pass approach
Multiple processing passes has many benefits
ƒ More control over calculations
ƒ New features that are not available using single-pass solutions
Each pass requires Crystal to read or manipulate data
Crystal processing top down, from left to right
ƒ Formulas in header processed before footer

Slide 75
Multi-Pass Reporting 2/7

Pre-Pass 1
ƒ Constant formulas are evaluated
ƒ Process known as BeforeReadingRecords
ƒ No database fields allowed
ƒ Example: 1000 * 25

Constant
formulas

Slide 76
Multi-Pass Reporting 3/7
Pass 1
ƒ Record retrieval (selection and sorting passed to database if possible)
ƒ Evaluate formulas with database fields (recurring formulas)
• Known as WhileReadingRecords
• NO references to subtotals or summaries
ƒ Record selection formulas
• Record selection too complex for database to handle
ƒ Records sorted, grouped, then totaled per group
ƒ Cross-tabs, charts, and maps
• Database fields and recurring formulas
• No running totals, PrintTime formulas
ƒ Processed data is saved, used for all other processing

Record Sorting, Save


Record Recurring
selection grouping, results
retrieval formulas
formulas totaling

Slide 77
Multi-Pass Reporting 4/7

Pre-Pass 2
ƒ Order groups
• Only for Top N, Bottom N, or Hierarchical Grouping reports
ƒ No data read
ƒ Uses saved data (group instances) from Pass 1

Sort groups Hierarchical


Top N grouping

Slide 78
Multi-Pass Reporting 5/7

Pass 2
ƒ Process group selection formulas
ƒ Running totals
ƒ Formulas that reference subtotals or summaries
• Known as PrintTime formulas
• Called WhilePrintingRecords process
ƒ Cross-tabs, charts, and maps
• Include running totals, PrintTime formulas
ƒ OLAP grids
ƒ Sub-reports
ƒ Page on demand generation

Group Running PrintTime Subreports, OLAP grids, Page


selection totals formulas charts, cross-tabs On Demand
maps

Slide 79
Multi-Pass Reporting 6/7

Pass 3
ƒ Total page count
ƒ Used for total page count, Page N of M formulas

Total
page count

Slide 80
Multi-Pass Reporting 7/7
Pass Summary
Constant
-1 formulas

Record Sorting, Save


Record Recurring
1 retrieval formulas
selection grouping, results
formulas totaling

Sort groups Hierarchical


-2 Top N grouping

Group Running PrintTime Subreports, OLAP grids, Page


2 selection totals formulas charts, cross-tabs On Demand
maps

Total
3 page count

Slide 81
The Storybook Ending

Slide 82
Q&A

Questions
Contact information
ƒ Alan Mayer
ƒ Phone: 214-637-6622
ƒ Email: amayer@integrasolutions.net

Slide 83

You might also like