You are on page 1of 26

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

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

Creating Reports Problem Statement 8. ©NIIT Creating Reports/Lesson 8/Slide 3 of 26 .D. The data should be presented in such a way that it can be analyzed easily.1 The Sales Manager of Diaz Telecommunications needs to view a report containing the order details and the summarized revenue for each month.

Identify the method to create a Crystal Report. Identify the method to host Crystal Report in a Windows application. ©NIIT Creating Reports/Lesson 8/Slide 4 of 26 . Create a Crystal Report for Windows application.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 enhance the Crystal Report presentation. Host the Crystal Report in the Windows application. View the Crystal Report.

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. 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 . Result: As per the given problem statement.

©NIIT Creating Reports/Lesson 8/Slide 6 of 26 .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.

and summary fields.Creating Reports Task 3: Identify the method to enhance the Crystal Report presentation. created to present summarized fields. in comparing and identifying trends. columns.  Cross-Tab object ® Is a grid and is inserted in a Crystal Report when the data is to be displayed in form of compact rows. The presentation quality of a Crystal Report can be enhanced by adding the following components to the Crystal Report:  Chart ® Allows ® Is easy analysis of the presented data. Creating Reports/Lesson 8/Slide 7 of 26 ® Helps ©NIIT .

(Contd.Creating Reports Task 3: Identify the method to enhance Crystal Report presentation. you need to insert a chart in the Crystal Report.) Result: Since the data is to be used for analysis purposes. ©NIIT Creating Reports/Lesson 8/Slide 8 of 26 .

Windows Forms Viewer  Is present as a control in the Toolbox. Result: You will use the Windows Forms Viewer to deliver the Crystal Report in the Windows application.  Can interact with other controls on the Windows Form.  Can be inserted into a Windows application by dragging the CystalReportViewer control from the Toolbox into the form. ©NIIT Creating Reports/Lesson 8/Slide 9 of 26 . A Crystal Report can be hosted in a Windows Form by using the Windows Forms Viewer.Creating Reports Task 4: Identify the method to host the Crystal Report in a Windows application.

©NIIT Creating Reports/Lesson 8/Slide 10 of 26 .Creating Reports Task 5: Create a Crystal Report for the Windows application. Task 7: View the Crystal Report. Task 6: Host the Crystal Report in the Windows application.

Creating Reports Problem Statement 8.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.D. In addition. ©NIIT Creating Reports/Lesson 8/Slide 11 of 26 . the Sales Manager also needs to view the percentage of the sale price paid as advance for each order.

Identify the method to host Crystal Report in a Windows application. Identify the method to create a Crystal Report. Create a Crystal Report for Windows application. ©NIIT Creating Reports/Lesson 8/Slide 12 of 26 . Retrieve the filtered data from the database. Host the Crystal Report in the Windows application.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. View the Crystal Report from the Windows Forms Viewer. Write the code to connect to the database.

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 .

(Contd.)  Cost  Advance  Percentage of the sale price paid as advance ©NIIT Creating Reports/Lesson 8/Slide 14 of 26 .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.

Creating Reports Task 2: Identify the method to create a Crystal Report. ©NIIT Creating Reports/Lesson 8/Slide 15 of 26 . Result: Since a calculated field of percentage needs to be displayed in the report. 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. you will create the Crystal Report manually.

Task 6: Host the Crystal Report in the Windows application. Task 5: Create a Crystal Report for the Windows application. Task 7: Write the code to connect to the database. Task 8: View the Crystal Report from the Windows Forms Viewer.Creating Reports Task 4: Retrieve the filtered data from the database. ©NIIT Creating Reports/Lesson 8/Slide 16 of 26 .

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). ©NIIT Creating Reports/Lesson 8/Slide 17 of 26 .P.Creating Reports Problem Statement 8. The data should be displayed in the form of compact rows and columns with an average customer feedback for each employee.

The product name for each product also needs to be displayed in the report.D. ©NIIT Creating Reports/Lesson 8/Slide 18 of 26 .3 The Sales Manager of Diaz Telecommunications needs to view a summarized product-wise order details report.Creating Reports Problem Statement 8.

Identify the method to create a Crystal Report. ©NIIT Creating Reports/Lesson 8/Slide 19 of 26 . View the Crystal Report from the Windows Forms Viewer. Host the Crystal Report in the Windows application. Create a Crystal Report for the Windows application.Creating Reports Task List Identify the data that needs to be displayed in the Crystal Report. Identify the method to host Crystal Report in a Windows application.

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 . Result: As per the given problem statement.Creating Reports Task 1: Identify the data that needs to be displayed in the Crystal Report.

Result: You will create the Crystal Report by using the Standard Report Expert since it involves minimum steps. Result:  You will use the Windows Forms Viewer to deliver the Crystal Report in the Windows application. Task 3: Identify the method to host the Crystal Report in a Windows application. ©NIIT Creating Reports/Lesson 8/Slide 21 of 26 .Creating Reports Task 2: Identify the method to create a Crystal Report.

Task 5: Host the Crystal Report in the Windows application. ©NIIT Creating Reports/Lesson 8/Slide 22 of 26 .Creating Reports Task 4: Create a Crystal Report for the Windows application. Task 6: View the Crystal Report from the Windows Forms Viewer.

Crystal Reports use database drivers to connect with the data source for accessing data. Crystal Reports in Visual Basic .Creating Reports Summary In this lesson. you learned that: Crystal Report is the standard reporting tool for Visual Studio .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 .NET for displaying data of presentation quality.

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. ©NIIT Creating Reports/Lesson 8/Slide 24 of 26 . the Windows Forms Viewer also dynamically updates the Crystal Report that is hosted. Apart from allowing an easy viewing of the Crystal Report in a Windows application.

Creating Reports Summary (Contd.  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.)  The Windows Forms Viewer can be inserted into a Windows application by dragging the CystalReportViewer control from the Toolbox into the form. ©NIIT Creating Reports/Lesson 8/Slide 25 of 26 .

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.Creating Reports Summary (Contd. it has to be bound to a CrystalReportViewer control.) To display a Crystal Report. ©NIIT Creating Reports/Lesson 8/Slide 26 of 26 .