(2) crystal reports

Upload: venkat143786

Post on 03-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 (2) Crystal Reports

    1/51

  • 8/13/2019 (2) Crystal Reports

    2/51

    2

    Agenda

    Crystal Reports

    Brief Overview.

    Reporting Fundamentals

    Customizing Reports

    Various Advanced Features

    Deploying Reports

    Samples

    More Information

  • 8/13/2019 (2) Crystal Reports

    3/51

    3

    What is Crystal Reports ?

    Crystal Reports is the standard reporting tool which has the ability to create

    presentation quality content

    It can be used for windows based applications as well as web based applications

  • 8/13/2019 (2) Crystal Reports

    4/51

    4

    Why Incorporate Reports into

    Applications?

    To present data to users, you could write code to loop through recordsets and print

    them inside your Windows or Web application.

  • 8/13/2019 (2) Crystal Reports

    5/51

    5

    What all you can do with Crystal Reports ?

    Choose from report layout options ranging from standard reports toform letters, or build your own report from scratch.

    Display charts that users can drill down on to view detailed report data.

    Calculate summaries, subtotals, and percentages on grouped data.

    Show TopN or BottomN results of data.

    Conditionally format text and rotate text objects.

  • 8/13/2019 (2) Crystal Reports

    6/51

    6

    There are five phases of the Report Design

    Define the Concept

    Sourcing the Data

    Creating the Design

    Developing & Testing the Design

    Deploying & Operating the Report

  • 8/13/2019 (2) Crystal Reports

    7/51

  • 8/13/2019 (2) Crystal Reports

    8/518

    Sourcing the Data

    Determine where the data for your report actually resides (a database,

    mainframe, file, etc.)

    A common problem here is that the data you to include does not exist

    Keep an eye out for fields that you need to calculate

  • 8/13/2019 (2) Crystal Reports

    9/519

    Creating the Design

    The best report is one that is completed on paper and is then recreated using Crystal

    Reports

    Revisit your prototype and from here decide which of the fields in your report are

    going to come from a database, need to be calculated and any formulas required

  • 8/13/2019 (2) Crystal Reports

    10/5110

    Developing & Testing the design

    With the previous steps done you are ready to open Crystal Reports

    Input your data and then test the report on different platforms.

    Note any performance issues and then revisit your report design

  • 8/13/2019 (2) Crystal Reports

    11/5111

    Deploying & Operating the

    Report

    The last step in this process it to consider how you report is going to be

    used

    Will it be exported?

    For ex., How does the report design translate when exported from Excelto Word?

  • 8/13/2019 (2) Crystal Reports

    12/5112

    Reporting Fundamentals

    When you create a report, you specify the data source of the report, design the

    report layout, and decide how you want users to access the report data.

    Report Data Access

    Report Design

    Report Distribution

    Adding Reports to Applications

  • 8/13/2019 (2) Crystal Reports

    13/5113

    Report Data Access

    Pull Model

    Driver will connect to the database and pull in data on demand. Both the

    connection to the database, and the SQL command that is performed to get the

    data, are handled by Crystal Reports itself and do not require any coding from the

    developer.

  • 8/13/2019 (2) Crystal Reports

    14/5114

    Report Data Access (Contd.)

    Push Model

    Involves the developer writing code to connect to the database,

    performing a SQL command to create a recordset or dataset that

    matches the fields in the report, and passing that object to the report.

    This method enables you to build connection-sharing into your

    application and to filter the data before Crystal Reports receives it

  • 8/13/2019 (2) Crystal Reports

    15/5115

    Some Database Drivers

    Database Driver Accessible Database Data Access Method

    OLEDB Any database that has

    an OLEDB Provider.

    Supports both pulling

    data from the

    database and pushing

    data into the report

    from an recordset.

    ODBC Any database that has

    an ODBC driver.

    Supports both pulling

    data from the

    database and pushing

    data into the report

    from an recordset.

  • 8/13/2019 (2) Crystal Reports

    16/51

  • 8/13/2019 (2) Crystal Reports

    17/5117

    Report Design

    Database Connection In the Crystal Report Designer, you first select the data source that your

    report will reference. You can use more than one data source in a report.

    Report Objects

    Database fields

    Formula fields

    Parameter fields

    Group Name fields

    Running Total fields

    Summary fields

    Charts

    Subreports

  • 8/13/2019 (2) Crystal Reports

    18/5118

    Report Design (Contd.)

    Report Sections

    The Crystal Report Designer is divided into report sections, such assection headers, footers, and details. You drag objects onto a reportsection.

    The data that appears in the finished report is contingent upon yourdesign choices. In particular, report data varies depending on the

    sections into which you choose to insert particular report objects.

    For example, if you insert a chart object in the Report Header section, thechart will appear only once at the beginning of the report and willsummarize the data contained in the report. Alternatively, if a chart objectis added to the Group Header section, a separate chart will appear at thebeginning of each group of data and will summarize the data relating onlyto that group.

  • 8/13/2019 (2) Crystal Reports

    19/51

    19

    Report Distribution

    View the Report

    The most common way to distribute Crystal Reports is to host themwithin an application so the report can be accessed by users.

    For Ex., Crystal Reports for Visual Studio .NET provides you with thefollowing viewers to host a Crystal report:

    Web Forms Viewers host reports in HTML (3.2 and 4.0) in Webapplications.

    Windows Forms Viewers host reports in Windows applications.

    You can program interaction between the viewer and other controls in theapplication. In addition, each report viewer comes with a pre-packagedtoolbar. You can customize the toolbar based on your application needs.

  • 8/13/2019 (2) Crystal Reports

    20/51

    20

    Report Distribution (Contd.)

    Export the Report

    Crystal reports can be exported to the following export formats.

    Export Formats

    Adobe Acrobat (.pdf)

    Crystal Reports for Visual Studio .NET (.rpt) HTML 3.2 and 4.0 (.html)

    Microsoft Excel (.xls)

    Microsoft Rich Text (.rtf)

    Microsoft Word (.doc)

    Export Destinations

    Disk file

    Microsoft Exchange public folders

  • 8/13/2019 (2) Crystal Reports

    21/51

    21

    Report Distribution (Contd.)

    Export Scenarios

    Server Applications

    Your application can be programmed to export a Crystal report

    automatically to any of the supported file formats. For example, using

    the Crystal Report Engine object model, you can create a server

    application that converts a Crystal report to a Word document and

    sends this converted file to a Microsoft Exchange folder every

    morning

    Windows Applications

    The Windows Form Viewer supports exporting (via the Export button

    on the toolbar) to all supported export formats

    Use code to customize the Windows Forms Viewer toolbar or add

    additional controls to set up the export options you want to make

    available to users.

  • 8/13/2019 (2) Crystal Reports

    22/51

    22

    Report Distribution (Contd.)

    Export Scenarios Web Applications

    The Web Forms Viewer displays reports in HTML one page at a

    time.

    For example, using the Crystal Report Engine object model, you canadd a button that prompts the user for an email address and then

    sends the request to the server on which the Crystal Report Engine

    processes the request. The user receives an email of the report in

    Word format.

    Print the Report

    you can create an application that automatically prints a Crystal report to

    a specific printer.

  • 8/13/2019 (2) Crystal Reports

    23/51

    23

    Report Deployment Scenarios

    Single Tier Applications

    Report components, report file (.rpt file) ,report engine are installed with

    the executable file on the user's machine.

  • 8/13/2019 (2) Crystal Reports

    24/51

  • 8/13/2019 (2) Crystal Reports

    25/51

    25

    Report Deployment Contd..

    Three Tier Applications

    A Report Web Service is a Crystal report that has been published, or exposed, forconsumption by an application.

    Over the Internet, a Windows or Web application can connect to a Report Web Service,consume the exposed Crystal report, and display the report for users by hosting it in a reportviewer.

  • 8/13/2019 (2) Crystal Reports

    26/51

    26

    Report Deployment Contd..

    Enterprise Applications

    If you are distributing an application that needs to support report viewing and deliveryacross a large company, you may require more than one report engine to handle allusers' report queries.

    Crystal Enterprise allows organizations to scale up (add more processors) or scale out(add more physical machines) to meet growing user demands. This system deliversweb speed performance for both on-demand and scheduled reports.

  • 8/13/2019 (2) Crystal Reports

    27/51

    27

    Report Web Services

    A Report Web Service is a Crystal report published as a Web Service thatis, the report's interfaces (for example: its classes, objects, methods,properties, and return values) are available in XML and can be transmittedacross the Internet.

    Other applications can access and use the report and its data without

    needing anything other than the ability to read XML.

    For example, you can create a Crystal report that shows your company'scurrent orders broken down by region. If you expose this report as a WebService, the company that manufactures the goods can add this Report WebService to its application and see new orders immediately.

  • 8/13/2019 (2) Crystal Reports

    28/51

    28

    Before Getting Started..

    Few points about, Crystal Report OCX

    RDC

    DataReport

  • 8/13/2019 (2) Crystal Reports

    29/51

    29

    Getting Started..

  • 8/13/2019 (2) Crystal Reports

    30/51

    30

    Start Working with Crystal Reports

  • 8/13/2019 (2) Crystal Reports

    31/51

    31

    Topics

    Create a Sample Report Connect to a Database

    Report header/page header/report footer/page footer

    Page Setup Options

    Creating Groups

    Creating Sections & Formatting Sections

    Subtotal/GrandTotal/Running Totals

    Special Fields

    Parameter Fields

    About Formulae

  • 8/13/2019 (2) Crystal Reports

    32/51

    32

    More Topics

    SubReports Passing parameters from main report to a subreport

    Accessing subreport value in main report

    Cross tab reports

    Runtime requirements for Crystal Reports, additional files are needed

    incase any export options are used.

    Integrating with Java/Client Server (VB) based applications.

    Crystal Report 9+ supports Java.

  • 8/13/2019 (2) Crystal Reports

    33/51

    33

    Custom Functions in Crystal Reports

    Designing User Function Libraries (UFLs)

    What are UFLs?

    Getting UFLs from Crystal Decisions

    Custom UFLs

    Creating UFLs in Visual Basic

    Using UFLs in Crystal Reports

    Seagate Info and Crystal Enterprise

  • 8/13/2019 (2) Crystal Reports

    34/51

    34

    What are UFLs?

    UFL = User Function Library

    Dynamic Link Library (DLL)

    Exposes custom functions to the Crystal Reports Formula Editor

    Provides more powerful data manipulation within reports

  • 8/13/2019 (2) Crystal Reports

    35/51

    35

    Where are UFLs?

    Located in \WINDOWS\Crystalor \WINNT\Crystaldirectory

    File name starts with U2Lor U5L(version 9 only supports U5L)

    U2LCOM.DLLsupports ActiveX DLLs ActiveX DLLs must have a CRUFLprefix

    Functions appear underAdditional Functionslist in Formula Editor

  • 8/13/2019 (2) Crystal Reports

    36/51

    36

    Where are UFLs? (U2L files)

  • 8/13/2019 (2) Crystal Reports

    37/51

  • 8/13/2019 (2) Crystal Reports

    38/51

    38

    Where are UFLs? (Formula Editor)

  • 8/13/2019 (2) Crystal Reports

    39/51

    39

    UFL Sources

    Installed with Crystal Reports

    Download from the Crystal Reports Support site

    Create a Windows DLL in C/C++

    Create an ActiveX DLL in Visual Basic, Delphi, or any COM compliant

    language

  • 8/13/2019 (2) Crystal Reports

    40/51

    40

    UFLs Installed with Crystal Reports

    Appear in the Additional Functions section of the Formula Editor

    Available functions include:

    Y2K conversions

    Date/Time and Date/Time string conversions

    String extraction and manipulation

    Functions for working with MS Exchange data

    Functions for working with the NT Event Log Functions for working with financial data

  • 8/13/2019 (2) Crystal Reports

    41/51

    41

    Getting UFLs from Crystal Decisions

    Available from the Crystal Decisions support site:

    http://support.crystaldecisions.com

    A list of available UFLs is found in:

    cr_ufls.pdf

    UFLs can be downloaded from:

    http://support.crystaldecisions.com/updates/

  • 8/13/2019 (2) Crystal Reports

    42/51

    42

    Custom UFLs

    Specialized functions for your business needs Appear inside the Crystal Reports Formula Editor

    Supported by Seagate Info and Crystal Enterprise

    Windows DLL written in C/C++

    ActiveX DLL written in Visual Basic, Delphi, etc.

  • 8/13/2019 (2) Crystal Reports

    43/51

  • 8/13/2019 (2) Crystal Reports

    44/51

    44

    Creating UFLs in Visual Basic

    Create a new ActiveX DLL project

    Name the project CRUFLXXX

    The Class module can contain one or more functions

    Name the class module according to the collection of functions

    you define

    Functions declared Public will appear in the Formula Editor

    Compile the DLL

    Functions appear in Crystal Reports as:

    XXXClassFunction

  • 8/13/2019 (2) Crystal Reports

    45/51

  • 8/13/2019 (2) Crystal Reports

    46/51

    46

    Using UFLs in Crystal Reports

    Compile the UFL

    Copy to the \WINDOWS\Crystal or \WINNT\Crystal

    directory

    Register ActiveX DLLs

    Access from the Formula Editor

  • 8/13/2019 (2) Crystal Reports

    47/51

    47

    Seagate Info and Crystal Enterprise

    UFLs are accessed at runtime: when report formulas areprocessed

    The UFL is required by the machine that processes the

    report

    The UFL goes in the \WINDOWS\Crystal or \WINNT\Crystal

    directory

  • 8/13/2019 (2) Crystal Reports

    48/51

    48

    The Future of UFLs

    UFLs continue to be supported in Crystal Reports 9

    NEW: Crystal Reports 9 introduces custom functions

    NEW: Crystal Repository provides easy reuse of custom functions

    UFL functions written in Visual Basic can be migrated to customfunctions written in Crystal Basic

  • 8/13/2019 (2) Crystal Reports

    49/51

    49

    More Information

    Crystal Reports for Visual Studio .Net: Getting Started,

    http://msdn.microsoft.com/library/default.asp?url=/library/en-

    us/crystlmn/html/crcongettingstarted.asp

    Crystal Decisions KBase

    http://support.crystaldecisions.com/kbase

  • 8/13/2019 (2) Crystal Reports

    50/51

    50

    Questions ?

  • 8/13/2019 (2) Crystal Reports

    51/51

    Thank You.