vb net tutorial 8

26
Creating Reports ©NIIT Creating Reports/Lesson 8/Slide 1 of 26 Objectives In this lesson, you will learn to: Identify the need for generating Crystal Reports Identify the Crystal Report Data Access models Create a Crystal Report for a Windows Form application Host a Crystal Report in a Windows application Enhance the Crystal Report presentation

Upload: malecsandrescu

Post on 03-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 1/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 1 of 26

Objectives

In this lesson, you will learn to:

Identify the need for generating Crystal Reports

Identify the Crystal Report Data Access models

Create a Crystal Report for a Windows Form application

Host a Crystal Report in a Windows application

Enhance the Crystal Report presentation

Page 2: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 2/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 2 of 26

Crystal Report

Is the standard reporting tool for Visual Studio .NET used todisplay summarized data.

Needs database drivers to connect with the data source for accessing data.

Supports two methods to access data from a data source:

The Pull model The Push model

Page 3: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 3/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 3 of 26

Problem Statement 8.D.1

The Sales Manager of Diaz Telecommunications needs toview a report containing the order details and the summarizedrevenue for each month. The data should be presented insuch a way that it can be analyzed easily.

Page 4: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 4/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 4 of 26

Task List

Identify the data that needs to be displayed in the CrystalReport and the format in which the data is to be

displayed.

Identify the method to create a Crystal Report.

Identify the method to enhance the Crystal Reportpresentation.

Identify the method to host Crystal Report in a Windowsapplication.

Create a Crystal Report for Windows application.

Host the Crystal Report in the Windows application.

View the Crystal Report.

Page 5: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 5/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 5 of 26

Task 1: Identify the data that needs to be displayed inthe Crystal Report and the format in which the datais to be displayed.

Result:

 As per the given problem statement, the data to bedisplayed in the Crystal Report is as follows:

Date

Inv

CustID

ProdID

Cost

 Advance

Page 6: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 6/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 6 of 26

Task 2: Identify the method to create a CrystalReport.

You can create a Crystal Report by using three methods:

Manually

Using Standard Report Expert

From an existing report

Result:

You will create the Crystal Report by using the StandardReport Expert since it involves minimum steps.

Page 7: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 7/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 7 of 26

Task 3: Identify the method to enhance the CrystalReport presentation.

The presentation quality of a Crystal Report can beenhanced by adding the following components to the

Crystal Report:

Chart

® Allows easy analysis of the presented data.

® Is created to present summarized fields. Cross-Tab object

® Is a grid and is inserted in a Crystal Report when thedata is to be displayed in form of compact rows,columns, and summary fields.

®Helps in comparing and identifying trends.

Page 8: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 8/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 8 of 26

Task 3: Identify the method to enhance CrystalReport presentation. (Contd.)

Result:

Since the data is to be used for analysis purposes, youneed to insert a chart in the Crystal Report.

Page 9: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 9/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 9 of 26

Task 4: Identify the method to host the CrystalReport in a Windows application.

 A Crystal Report can be hosted in a Windows Form byusing the Windows Forms Viewer.

Windows Forms Viewer 

Is present as a control in the Toolbox.

Can be inserted into a Windows application by dragging

the CystalReportViewer control from the Toolbox intothe form.

Can interact with other controls on the Windows Form.

Result:

You will use the Windows Forms Viewer to deliver theCrystal Report in the Windows application.

Page 10: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 10/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 10 of 26

Task 5: Create a Crystal Report for the Windowsapplication.

Task 6: Host the Crystal Report in the Windows

application.Task 7: View the Crystal Report.

Page 11: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 11/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 11 of 26

Problem Statement 8.D.2

The Sales Manager of Diaz Telecommunications needs toview a summarized report containing the order details for theproducts with sale price greater than $3000 to identify thepotential market for the products in the coming period. Inaddition, the Sales Manager also needs to view thepercentage of the sale price paid as advance for each order.

Page 12: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 12/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 12 of 26

Task List

Identify the data that needs to be displayed in the CrystalReport and the format in which the data is to be

displayed.

Identify the method to create a Crystal Report.

Identify the method to host Crystal Report in a Windowsapplication.

Retrieve the filtered data from the database.

Create a Crystal Report for Windows application.

Host the Crystal Report in the Windows application.

Write the code to connect to the database.

View the Crystal Report from the Windows Forms Viewer.

Page 13: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 13/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 13 of 26

Task 1: Identify the data that needs to be displayed inthe Crystal Report and the format in which the data

is to be displayed.

Result: As per the given problem statement, the data to bedisplayed in the Crystal Report is as follows:

ProdID

Inv

Date

CustID

Page 14: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 14/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 14 of 26

Task 1: Identify the data that needs to be displayed inthe Crystal Report and the format in which the data

is to be displayed. (Contd.)

Cost Advance

Percentage of the sale price paid as advance

Page 15: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 15/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 15 of 26

Task 2: Identify the method to create a CrystalReport.

Result:

Since a calculated field of percentage needs to be displayedin the report, you will create the Crystal Report

manually.

Task 3: Identify the method to host the Crystal

Report in a Windows application.

Result:

You will use the Windows Forms Viewer to host the Crystal

Report in the Windows application.

Page 16: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 16/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 16 of 26

Task 4: Retrieve the filtered data from the database. 

Task 5: Create a Crystal Report for the Windows

application. 

Task 6: Host the Crystal Report in the Windowsapplication. 

Task 7: Write the code to connect to the database.

Task 8: View the Crystal Report from the WindowsForms Viewer.

Page 17: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 17/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 17 of 26

Problem Statement 8.P.1

 An HR Manager of Diaz Telecommunications needs to view areport containing the query handling details for each employeeafter 9th July 2001 (the date of creation of the HR policy). Thedata should be displayed in the form of compact rows andcolumns with an average customer feedback for eachemployee.

Page 18: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 18/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 18 of 26

Problem Statement 8.D.3

The Sales Manager of Diaz Telecommunications needs toview a summarized product-wise order details report. Theproduct name for each product also needs to be displayed inthe report.

Page 19: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 19/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 19 of 26

Task List

Identify the data that needs to be displayed in the CrystalReport.

Identify the method to create a Crystal Report.Identify the method to host Crystal Report in a Windowsapplication.

Create a Crystal Report for the Windows application.Host the Crystal Report in the Windows application.

View the Crystal Report from the Windows Forms Viewer.

Page 20: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 20/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 20 of 26

Task 1: Identify the data that needs to be displayed inthe Crystal Report.

Result:

 As per the given problem statement, the data to bedisplayed in the Crystal Report is as follows:

Prod ID

Product Name

Inv

Date

CustID

Cost

 Advance

Page 21: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 21/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 21 of 26

Task 2: Identify the method to create a CrystalReport.

Result:

You will create the Crystal Report by using the StandardReport Expert since it involves minimum steps.

Task 3: Identify the method to host the Crystal

Report in a Windows application.

Result:

You will use the Windows Forms Viewer to deliver theCrystal Report in the Windows application.

Page 22: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 22/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 22 of 26

Task 4: Create a Crystal Report for the Windowsapplication.

Task 5: Host the Crystal Report in the Windows

application.Task 6: View the Crystal Report from the Windows

Forms Viewer.

Page 23: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 23/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 23 of 26

Summary

In this lesson, you learned that:

Crystal Report is the standard reporting tool for Visual

Studio .NET for displaying data of presentation quality.Crystal Reports use database drivers to connect with the

data source for accessing data.

Crystal Reports in Visual Basic .NET supports two methodsto access data from a data source:

The Pull model

The Push model

Page 24: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 24/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 24 of 26

Summary (Contd.)

The presentation quality of a Crystal Report can beenhanced by adding the following components to theCrystal Report:

Chart

Cross-tab object

 A Crystal Report can be hosted in a Windows Form byusing the Windows Forms Viewer.

 Apart from allowing an easy viewing of the Crystal Report ina Windows application, the Windows Forms Viewer  

also dynamically updates the Crystal Report that is hosted.

Page 25: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 25/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 25 of 26

Summary (Contd.)

The Windows Forms Viewer can be inserted into aWindows application by dragging the CystalReportViewer control from the Toolbox into the form.

The Windows Forms Viewer contains the followingcomponents:

Toolbar 

Group Tree

Main Report Window

 An interaction can be created between the Windows Forms

Viewer and other controls on the Windows Form byhandling the events of the Windows Form controls and theWindows Forms Viewer.

Page 26: VB Net Tutorial 8

7/29/2019 VB Net Tutorial 8

http://slidepdf.com/reader/full/vb-net-tutorial-8 26/26

Creating Reports

©NIIT Creating Reports/Lesson 8/Slide 26 of 26

Summary (Contd.)

To display a Crystal Report, it has to be bound to aCrystalReportViewer control.

 A Crystal Report can be bound to a CrystalReportViewer control by setting the ReportSource property of the

CrystalReportViewer control to the path of the CrystalReport file.