More Related Content
Similar to Vb net xp_08 (20)
Vb net xp_08
- 1. Creating Reports
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
©NIIT Creating Reports/Lesson 8/Slide 1 of 26
- 2. Creating Reports
Crystal Report
Is the standard reporting tool for Visual Studio .NET used to
display 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
©NIIT Creating Reports/Lesson 8/Slide 2 of 26
- 3. Creating Reports
Problem Statement 8.D.1
The Sales Manager of Diaz Telecommunications needs to
view a report containing the order details and the summarized
revenue for each month. The data should be presented in
such a way that it can be analyzed easily.
©NIIT Creating Reports/Lesson 8/Slide 3 of 26
- 4. Creating Reports
Task List
Identify the data that needs to be displayed in the Crystal
Report 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 Report
presentation.
Identify the method to host Crystal Report in a Windows
application.
Create a Crystal Report for Windows application.
Host the Crystal Report in the Windows application.
View the Crystal Report.
©NIIT Creating Reports/Lesson 8/Slide 4 of 26
- 5. Creating Reports
Task 1: Identify the data that needs to be displayed
in the Crystal Report and the format in which the
data is to be displayed.
Result:
As per the given problem statement, the data to be
displayed in the Crystal Report is as follows:
Date
Inv
CustID
ProdID
Cost
Advance
©NIIT Creating Reports/Lesson 8/Slide 5 of 26
- 6. Creating Reports
Task 2: Identify the method to create a Crystal
Report.
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 Standard
Report Expert since it involves minimum steps.
©NIIT Creating Reports/Lesson 8/Slide 6 of 26
- 7. Creating Reports
Task 3: Identify the method to enhance the Crystal
Report presentation.
The presentation quality of a Crystal Report can be
enhanced 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
® Isa grid and is inserted in a Crystal Report when the
data is to be displayed in form of compact rows,
columns, and summary fields.
® Helps in comparing and identifying trends.
©NIIT Creating Reports/Lesson 8/Slide 7 of 26
- 8. Creating Reports
Task 3: Identify the method to enhance Crystal
Report presentation. (Contd.)
Result:
Since the data is to be used for analysis purposes, you
need to insert a chart in the Crystal Report.
©NIIT Creating Reports/Lesson 8/Slide 8 of 26
- 9. Creating Reports
Task 4: Identify the method to host the Crystal
Report in a Windows application.
A Crystal Report can be hosted in a Windows Form by
using 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 into
the form.
Can interact with other controls on the Windows Form.
Result:
You will use the Windows Forms Viewer to deliver the
Crystal Report in the Windows application.
©NIIT Creating Reports/Lesson 8/Slide 9 of 26
- 10. Creating Reports
Task 5: Create a Crystal Report for the Windows
application.
Task 6: Host the Crystal Report in the Windows
application.
Task 7: View the Crystal Report.
©NIIT Creating Reports/Lesson 8/Slide 10 of 26
- 11. Creating Reports
Problem Statement 8.D.2
The Sales Manager of Diaz Telecommunications needs to
view a summarized report containing the order details for the
products with sale price greater than $3000 to identify the
potential market for the products in the coming period. In
addition, the Sales Manager also needs to view the
percentage of the sale price paid as advance for each order.
©NIIT Creating Reports/Lesson 8/Slide 11 of 26
- 12. Creating Reports
Task List
Identify the data that needs to be displayed in the Crystal
Report 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 Windows
application.
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.
©NIIT Creating Reports/Lesson 8/Slide 12 of 26
- 13. Creating Reports
Task 1: Identify the data that needs to be displayed
in the Crystal Report and the format in which the
data is to be displayed.
Result:
As per the given problem statement, the data to be
displayed in the Crystal Report is as follows:
ProdID
Inv
Date
CustID
©NIIT Creating Reports/Lesson 8/Slide 13 of 26
- 14. Creating Reports
Task 1: Identify the data that needs to be displayed
in the Crystal Report and the format in which the
data is to be displayed. (Contd.)
Cost
Advance
Percentage of the sale price paid as advance
©NIIT Creating Reports/Lesson 8/Slide 14 of 26
- 15. Creating Reports
Task 2: Identify the method to create a Crystal
Report.
Result:
Since a calculated field of percentage needs to be displayed
in 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.
©NIIT Creating Reports/Lesson 8/Slide 15 of 26
- 16. Creating Reports
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 Windows
application.
Task 7: Write the code to connect to the database.
Task 8: View the Crystal Report from the Windows
Forms Viewer.
©NIIT Creating Reports/Lesson 8/Slide 16 of 26
- 17. Creating Reports
Problem Statement 8.P.1
An HR Manager of Diaz Telecommunications needs to view a
report containing the query handling details for each employee
after 9th July 2001 (the date of creation of the HR policy). The
data should be displayed in the form of compact rows and
columns with an average customer feedback for each
employee.
©NIIT Creating Reports/Lesson 8/Slide 17 of 26
- 18. Creating Reports
Problem Statement 8.D.3
The Sales Manager of Diaz Telecommunications needs to
view a summarized product-wise order details report. The
product name for each product also needs to be displayed in
the report.
©NIIT Creating Reports/Lesson 8/Slide 18 of 26
- 19. Creating Reports
Task List
Identify the data that needs to be displayed in the Crystal
Report.
Identify the method to create a Crystal Report.
Identify the method to host Crystal Report in a Windows
application.
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.
©NIIT Creating Reports/Lesson 8/Slide 19 of 26
- 20. Creating Reports
Task 1: Identify the data that needs to be displayed
in the Crystal Report.
Result:
As per the given problem statement, the data to be
displayed in the Crystal Report is as follows:
Prod ID
Product Name
Inv
Date
CustID
Cost
Advance
©NIIT Creating Reports/Lesson 8/Slide 20 of 26
- 21. Creating Reports
Task 2: Identify the method to create a Crystal
Report.
Result:
You will create the Crystal Report by using the Standard
Report 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 the
Crystal Report in the Windows application.
©NIIT Creating Reports/Lesson 8/Slide 21 of 26
- 22. Creating Reports
Task 4: Create a Crystal Report for the Windows
application.
Task 5: Host the Crystal Report in the Windows
application.
Task 6: View the Crystal Report from the Windows
Forms Viewer.
©NIIT Creating Reports/Lesson 8/Slide 22 of 26
- 23. Creating Reports
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 methods
to access data from a data source:
The Pull model
The Push model
©NIIT Creating Reports/Lesson 8/Slide 23 of 26
- 24. Creating Reports
Summary (Contd.)
The presentation quality of a Crystal Report can be
enhanced by adding the following components to the
Crystal Report:
Chart
Cross-tab object
A Crystal Report can be hosted in a Windows Form by
using the Windows Forms Viewer.
Apart from allowing an easy viewing of the Crystal Report in
a Windows application, the Windows Forms Viewer
also dynamically updates the Crystal Report that is hosted.
©NIIT Creating Reports/Lesson 8/Slide 24 of 26
- 25. Creating Reports
Summary (Contd.)
The Windows Forms Viewer can be inserted into a
Windows application by dragging the CystalReportViewer
control from the Toolbox into the form.
The Windows Forms Viewer contains the following
components:
Toolbar
Group Tree
Main Report Window
An interaction can be created between the Windows Forms
Viewer and other controls on the Windows Form by
handling the events of the Windows Form controls and the
Windows Forms Viewer.
©NIIT Creating Reports/Lesson 8/Slide 25 of 26
- 26. Creating Reports
Summary (Contd.)
To display a Crystal Report, it has to be bound to a
CrystalReportViewer 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 Crystal
Report file.
©NIIT Creating Reports/Lesson 8/Slide 26 of 26