Vous êtes sur la page 1sur 9

W H I T E P AP E R

EMBEDDING A CRYSTAL XCELSIUS


VISUALIZATION INSIDE CRYSTAL
REPORTS 2008

Author: Takin Babaei


Contributors: Henry Kam
Audience: IT-Professionals

Part 1: Background 1
Introduction 1
What’s New in Crystal Reports 2008? 2
How Do Crystal Reports and Crystal Xcelsius 4.5 Work Together? 2
What Is Crystal Xcelsius? 2
How Does It Work? 3
Part 2: Building a Crystal Xcelsius What-If Visual Model for Crystal Reports 4
Setting Up Your Crystal Reports Data for Crystal Xcelsius 4
Building Your Model in Crystal Xcelsius 4
Setting Your Crystal Xcelsius Model to Receive Real-Time Crystal Reports
Data 6
Part 3: Embedding Your Crystal Xcelsius Model Inside Crystal Reports 7
Miscellaneous 8
More Information 8
About Business Objects 9

PART 1: BACKGROUND
INTRODUCTION
This paper was written for Crystal Reports® 2008 users interested in learning more about
using Crystal Xcelsius™ to create interactive visualizations for their reports. The purpose of
the paper is to give your report authors a deeper understanding of the steps involved in
creating Crystal Xcelsius visualizations and embedding them inside Crystal Reports, so
authors can determine how to utilize Crystal Xcelsius for their own projects.

This whitepaper walks you through:

• Creating a simple Crystal Xcelsius visual model

• Embedding the visual model inside Crystal Reports and linking it to Crystal Reports data

Assumes you have a good understanding of

• Crystal Reports

And you already own:

• BusinessObjects™ Xcelsius Enterprise, Crystal Xcelsius Designer, or Crystal Xcelsius


Workgroup

• Crystal Reports 2008

BusinessObjects. Embedding a Crystal Xcelsius Visualization Inside Crystal Reports 2008 1


WHAT’S NEW IN CRYSTAL REPORTS 2008?
Crystal Reports 2008 provides advanced functionality to help reduce report proliferation and
maintenance—increasing visualization flexibility and saving time with highly productive design
features, which include:

• Xcelsius integration

• Flex integration

• Flash integration

• Report parameter panel

• Interactive report viewing

• Powerful crosstabs

• Flexible pagination

For more information please visit:


http://www.businessobjects.com/product/catalog/crystalreports/features.asp

HOW DO CRYSTAL REPORTS AND CRYSTAL XCELSIUS 4.5


WORK TOGETHER?
Visualize the potential outcome of your business decisions with what-if scenario models built
into your report file. Import Xcelsius-generated SWF files into your reports and benefit from
improved design-time integration. IT and developers will design fewer reports to support the
decision-making process. Please note: Xcelsius design tool is not included in Crystal Reports
2008.

View Demo: What-if Analysis

WHAT IS CRYSTAL XCELSIUS?


Crystal Xcelsius is point-and-click data visualization software for creating interactive charts,
graphs, what-if scenario models, and delivering them as part of Crystal Reports, Microsoft
Office, Adobe PDF, and the web.

Crystal Xcelsius enables you to visualize and interact with your business and corporate data.

BusinessObjects. Embedding a Crystal Xcelsius Visualization Inside Crystal Reports 2008 2


HOW DOES IT WORK?
Crystal Xcelsius uses a unique combination of Microsoft Excel, as a data modeling tool, and
Macromedia Flash Player, as the rendering engine, to compile dynamic visualizations via its
proprietary Crystal Xcelsius Designer. Within Crystal Xcelsius, Excel is used solely as a data
design tool to help integrate and manipulate data into a format that is easy to bind to and that
is used for common charting and data visualization components.

At design time, Excel is used to model and format data while the Crystal Xcelsius Designer is
used to visualize and bind Excel-modeled data to interactive visualizations via the Flash
engine. Once a design is ready to be deployed or previewed, Crystal Xcelsius then does its
“magic” and compiles the data model and visualization elements into Flash byte code in the
form of a .swf file. This .swf file now contains a virtual representation of your data and its
relationships as defined in the Excel model—as well as all the graphic assets and animations
bound to this data. The .swf file also contains information for any external data connections
that you specified at design time. These data connections can be used to replace the existing
data you designed within Excel with different sets of data at runtime, thus allowing multiple
queries into larger data stores.

Once the Flash movie is running, you’re no longer connected to the Excel file in any way—all
data has been virtualized into the Flash byte code or is being fed by dynamic XML feeds. So
you end up with an easy-to-use (Excel) and simple (row/column) metaphor for modeling and
manipulating your data, without any of Excel’s limitations. Once you begin using this paradigm,
you realize how powerful it is—you can massage data much more quickly with Excel than you
can programmatically.

Note: For more detail, see “Crystal Xcelsius for Developers: Technology Overview and
Introduction” by Thomas W. Gonzalez (http://diamond.businessobjects.com/node/183).

BusinessObjects. Embedding a Crystal Xcelsius Visualization Inside Crystal Reports 2008 3


PART 2: BUILDING A CRYSTAL
XCELSIUS WHAT-IF VISUAL MODEL
FOR CRYSTAL REPORTS
SETTING UP YOUR CRYSTAL REPORTS DATA FOR CRYSTAL
XCELSIUS
Download Sample Files

Use the Export-to-Excel function in Crystal Reports to export your report data to an Excel
spreadsheet. For this example, I have exported the data in db2.mdb to Book1.xls and added
some Excel logic. Let’s take a look at the spreadsheet:

The spreadsheet holds the market share data for “My Company” and three of its competitors.
Using a simple Excel formula, you can perform a simple what-if analysis and predict how
increasing or decreasing sales growth can affect your market share. This can be done by
adjusting the value in the sales growth column. Later, we’ll see how Xcelsius makes this what-
if analysis faster and easier.

BUILDING YOUR MODEL IN CRYSTAL XCELSIUS

Step 1: Start your Crystal Xcelsius application. To bring book1.xls inside your Crystal Xcelsius
application, on the toolbar click the Excel icon.

Step 2: In the component window, expand the Charts folder. Drag and drop a pie chart onto
the canvas.

Step3: Expand the Single Value folder. Then, select and expand the Slider folder. Finally, drag
and drop a horizontal slider onto the canvas.

Step 4: Double-click the pie chart and open up its properties.


Step 5: Change the chart title to Market Share.

Step 6: Click the Series radio button. To add a new series, click the plus-sign button.

Step 7: Link the x-values of the chart to the data in the spreadsheet by clicking the select

range icon.
Step 8: Highlight the cells C6:C9 and click OK.

Step 9: In the Category Axis labels section, click the select range icon. In the
spreadsheet, select the cells A6:A9.

BusinessObjects. Embedding a Crystal Xcelsius Visualization Inside Crystal Reports 2008 4


Now, your chart should look like this:

Step 10: Double-click the Slider to open up its properties.

Step 11: In the Title section, click the select range icon and select D5 in the spreadsheet.

Step 12: In the Data section, click the select range icon and select D6 in the spreadsheet.

Step 13: Click the Behavior tab and change the increment size to 0.1.

Now, your model should look like this:

Step 14: Click the Preview button. Move the slider to perform your what-if analysis.

Step 15: In the toolbar, click the fit-to-canvas icon to fit the size of the canvas to your
visual model.

BusinessObjects. Embedding a Crystal Xcelsius Visualization Inside Crystal Reports 2008 5


SETTING YOUR CRYSTAL XCELSIUS MODEL TO RECEIVE REAL-
TIME CRYSTAL REPORTS DATA
In Crystal Reports 2008, you can pass your report data to any flash objects via FlashVars (a
common way to assign variables for a Flash movie). To setup your Crystal Xcelsius model to
consume Crystal Reprots data in real-time via Flashvars, do the following:
Step 1: Select the path File -> Export Settings.

Step 2: Select the radio button Use Flash Variables.

Step 3: Select CSV Format.

Step 4: Click the button Define Variables.

Step 5: Add a new variable.


Step 6: Change the name to Titles.

Step 5: In the Variables Selection, click the select range icon and highlight the cells A6:A9.
Click OK.

Step 7: Add another variable.


Step 8: Change the name to Values.

Step 9: In the Variables Selection, click the select range icon and highlight the cells
B6:B9. Click OK.

Step 10: Select File -> Export to SWF.

You’re done.

BusinessObjects. Embedding a Crystal Xcelsius Visualization Inside Crystal Reports 2008 6


PART 3: EMBEDDING YOUR CRYSTAL
XCELSIUS MODEL INSIDE CRYSTAL
REPORTS
Once you’ve created your Xcelsius SWF file, you can then embed this into a Crystal report:
Step 1: Start your Crystal Reports 2008 application and open Report1.rpt

Step 2: Create a formula field and call it BuildTitlesString. The formula should contain the
following:
global stringvar TitlesString;

if (TitlesString = "") then


TitlesString := Cstr({Table1.Company Name})
else
TitlesString := TitlesString + "," +
Cstr({Table1.Company Name});
TitlesString;

Step 3: Create a second formula field and call it BuildValuesString. The formula should
contain the following:
global stringvar ValuesString;

if (ValuesString = "") then


ValuesString := Cstr({Table1.Market Share})
else
ValuesString := ValuesString + "," +
Cstr({Table1.Market Share});
ValuesString;

Step 4: From the menu, select Insert -> Flash…. Browse and select Model.swf, and drop this
onto the Report Footer section of the report. (You can also insert the flash object with the
toolbar button Insert Flash Object.)

Step 5: Click the flash object on the report to highlight it and then either select from the menu
Format-> Flash Data Expert… or right-click the Flash Object and select Flash Data
Expert….

In the Flash Data Binding Expert section, click the plus-sign button (“+”). Type Titles for the
variable name. To pass the value into the Titles Flash Variable, you have three options:

1. Manually type in the string values you want to pass into the Flash Variable (40
character maximum)

2. Click the drop-down button on the text box to select from an existing Field Object to
pass to the Flash Variable.

3. Click the Formula Builder button beside the text box to create the string to pass the
Flash Variable via formula logic.
In this case, use option 2 and select BuildTitlesString from the drop down.

Click the plus-sign (“+”) button again and type in Values for the variable name. For value,
select BuildValuesString from the drop-down menu.

To exit the Flash Data Binding Expert, click Okay. You have now successfully embedded an
Xcelsius-created Flash Object into Crystal Reports and bound the Flash Object to data from
the report. If the Flash Object is interactive, double-click on the Flash Object within the Crystal
Reports Preview Tab to set focus to the object. You can then freely click on any interactive
controls in the Flash Object.

BusinessObjects. Embedding a Crystal Xcelsius Visualization Inside Crystal Reports 2008 7


In the example above, the Flash Object was inserted into the Report Footer Section. To insert
the Flash Object anywhere on the report, to continue to pass in the data properly you will need
create the CSV string inside a subreport located in the Report Header and pass the CSV string
to the Flash Object via a shared variable. The following Business Objects knowledgebase
article describes how to use shared variables:

http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&
externalId=c2007600&sliceId=&dialogID=10026797&stateId=1 0 10030392

To properly support the subreport so it doesn’t display in the main report, follow the steps
outlined in this knowledgebase article:

http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&do
cType=kc&externalId=c2017039&sliceId=&dialogID=10026797&stateId=1 0 10030392

MISCELLANEOUS
• The maximum length of the comma-separated string that can be passed into the Flash
Variable is 65,536 characters.

• The Xcelsius SWF may also expect to be passed a multidimensional data range, such as a
3 X 3 grid of values:

1 2 3
4 5 6
7 8 9

To pass in data to the Flash Variable properly, the corresponding comma-separated string
would be “1,2,3,4,5,6,7,8,9”.

• Currently, to view Crystal Reports with embedded Flash Objects, you can utilize the Crystal
Reports Preview tab or, within a .NET Web Application, use the Crystal Reports .NET
Webform Report Viewer.

MORE INFORMATION
Crystal Xcelsius Products:

http://www.businessobjects.com/products/crystalxcelsius/default.asp

Crystal Reports 2008:

www.businessobjects.com//crystalreports2008

Technical Support:

http://support.businessobjects.com/

Diamond Community:

http://diamond.businessobjects.com/

BusinessObjects. Embedding a Crystal Xcelsius Visualization Inside Crystal Reports 2008 8


ABOUT BUSINESS OBJECTS
Business Objects has been a pioneer in business intelligence (BI) since the dawn of the
category. Today, as the world’s leading BI software company, Business Objects transforms the
way the world works through intelligent information. The company helps illuminate
understanding and decision-making at more than 44,000 organizations around the globe.
Through a combination of innovative technology, global consulting and education services, and
the industry’s strongest and most diverse partner network, Business Objects enables
companies of all sizes to make transformative business decisions based on intelligent,
accurate, and timely information.

© 2007 Business Objects. All rights reserved. Business Objects and the Business Objects
logo, BusinessObjects, Crystal Reports, Crystal Xcelsius, Crystal Decisions, Intelligent
Question, Desktop Intelligence, Crystal Enterprise, Crystal Analysis, Web Intelligence,
RapidMarts, and BusinessQuery are trademarks or registered trademarks of Business Objects
in the United States and/or other countries. All other names mentioned herein may be
trademarks of their respective owners.

businessobjects.com

insight.businessobjects.com

© 2007 Business Objects. All rights reserved. Part # WP3120-A

Vous aimerez peut-être aussi