Escolar Documentos
Profissional Documentos
Cultura Documentos
Page 1
Sponsored Tutorial
EclipseCon 2006
Overview:
This module will take you through the Crystal Reports for Eclipse report design experience. It will introduce the users to new and existing functionality found within the Eclipse-based designer
Learning Objectives:
Upon completion of this module users will be able to: Create a new Crystal Report Use Parameters to filter data Insert a Cross-Tab object Use the Crystal Formula language to customize look and feel of reports Know when and how to include a subreport in the report
Introduction
This module is designed to introduce the user to Crystal Reports and specifically the Crystal Reports for Eclipse report design experience. The user will create 3 reports which will be used later in the Development tutorial.
Page 2
Sponsored Tutorial
EclipseCon 2006
Page 3
Sponsored Tutorial
EclipseCon 2006
3. Click Next 4. Enter the Name of the Project Crystal Reports Demo 5. Click Finish 6. You should now see a new Project in the Navigator view, right-click on the Project and select New -> Other 7. From this dialog expand the Crystal Reports folder and select the Blank Report option
Page 4
Sponsored Tutorial
EclipseCon 2006
8. Call the report SalesHistoryByCustomerReport.rpt and click Finish 9. This action will launch the Crystal Reports Perspective
Page 5
Sponsored Tutorial
EclipseCon 2006
1. In the Database Explorer view right-click on the Connections folder and select the option New Connection. This will launch the dialog to customize the data source connection properties 2. Unfortunately the Derby Server does not have a pre-defined configuration option. Therefore we must choose Other and input the following properties: Database: Underground JDBC Driver Class: org.apache.derby.jdbc.ClientDriver Class location: derbyclient.jar (Browse to Derby\lib) Connection URL: jdbc:derby://localhost:1527/Underground;create=true
3. Use the following credentials and then click the Test Connection button to ensure that everything is working as expected: User ID: bobj Password: bobj
Copyright 2004 Business Objects. All rights reserved.
Page 6
Sponsored Tutorial
EclipseCon 2006
4. Users can opt to click Finish at this point, or click Next to provide them with the ability to Filter the tables being displayed. If you choose to filter the tables, be sure to enable the BOBJ table 5. Upon completing the wizard successfully users should be able to expand the newly created Underground connection in the Database Explorer view. This view will show all of the tables and will be the main source for adding the required tables to the report.
5. In the Field Explorer, expand the VW_SALES_HISTORY table to see the available fields 6. Save the Report it is good practice to save the report after any modification
Page 7
Sponsored Tutorial
EclipseCon 2006
8. Using either the toolbar or the Properties View change the properties of the GroupName field to the following: a. b. c. d. Font: Arial Font Size: 11 Width: 2.125 Height: 0.155
11. Insert the following fields to the Body section of the report. This can be achieved by either dragging and dropping the fields from the Field Explorer or right-clicking on the Field and selecting the Insert option: a. b. c. d. e. SALES_DATE PRODUCT_NAME QUANTITY SALES_PRICE TOTAL_SALE
12. Make the following modifications to the report fields using the Properties View: a. SALES_DATE i. Font: Arial ii. Size: 10 iii. Height: 0.146 iv. Left: 1.875 v. Width: 1.083 vi. Horizontal Alignment: Centered b. PRODUCT_NAME i. Font: Arial ii. Size: 10 iii. Height: 0.146 iv. Left: 3.219 v. Width: 1.479 vi. Horizontal Alignment: Centered c. QUANTITY i. Font: Arial ii. Size: 10 iii. Height: 0.146 iv. Left: 4.917 v. Width: 0.541 vi. Horizontal Alignment: Default d. SALES_PRICE i. Font: Arial ii. Size: 10 iii. Height: 0.146 iv. Left: 6.022 v. Width: 0.728 vi. Horizontal Alignment: Default vii. Use System Default: False viii. Currency Symbol Format: Floating e. TOTAL_SALE
Page 8
Sponsored Tutorial
EclipseCon 2006
Font: Arial Size: 10 Height: 0.146 Left: 7.083 Width: 0.676 Horizontal Alignment: Default Use System Default: False Currency Symbol Format: Floating
Page 9
Sponsored Tutorial
EclipseCon 2006
e.
TOTAL SALE i. RGB: 60,120,0 ii. Font: Arial iii. Size: 11 iv. Height: 0.146 v. Left: 6.917 vi. Top: 0.417 vii. Width: 0.979 viii. Horizontal Alignment: Right
Page 10
Sponsored Tutorial
EclipseCon 2006
Bottom Line Style: Double Top Line Style: Single RGB: 60,120,0 Font: Arial Size: 11 Height: 0.227 Left: 5.083 Top: 0.153 Width: 0.728 Horizontal Alignment: Centered Use System Default: False Decimals: 0
d. Sum({VW_SALES_HISTORY.TOTAL_SALE}) i. Bottom Line Style: Double ii. Top Line Style: Single iii. RGB: 60,120,0 iv. Font: Arial v. Size: 11 vi. Height: 0.227 vii. Left: 7.083 viii. Top: 0.153 ix. Width: 0.681 x. Horizontal Alignment: Right xi. Use System Default: False xii. Currency Symbol Format: Floating 22. Save the Report
24. After the title has been added we can now add a special field. To do this expand the Special Fields icon in the palette. Scroll down until you see the Page Number field. Drag this field on to the Page Footer area. Make the following modifications to the Page Number field: i. ii. iii. iv. v. Font: Arial Size: 10 Height: 0.155 Left: 7.213 Top: 0.31
Page 11
Sponsored Tutorial
EclipseCon 2006
Page 12
Sponsored Tutorial
EclipseCon 2006
Next drag the CR_PRODUCT.PRODUCT _NAME field just to the right of the PRODUCT_SUB_CATEGORY_NAME field (as indicated by the highlighted square in the picture below)
Page 13
Sponsored Tutorial
EclipseCon 2006
Finally, drag and drop the CR_WAREHOUSE_PRODUCT.QUANTITY_ON_HAND field beneath the Total column (as indicated by the highlighted square in the picture below)
The user should see the following if all has steps have been followed correctly thus far
b.
c.
d.
Sponsored Tutorial
EclipseCon 2006
1. Font Color: RGB{0,128,0} 2. Font Name: Arial 3. Font Size: 10 4. Font Style: Regular 5. Height: 0.155 6. Width:1.361 e. QUANTITY_ON_HAND (Summaries) i. PRODUCT_SUB_CATEGORY_NAME 1. Font Name: Arial 2. Font Size: 10 3. Height: 0.154 4. Width:1.361 5. Use System Default: False 6. Decimals: 0 ii. PRODUCT _NAME 1. Font Name: Arial 2. Font Size: 10 3. Height: 0.153 4. Width:1.361 5. Use System Default: False 6. Decimals: 0 iii. Total Row by Total Column 1. Bottom Line Style: Double 2. Font Color: RGB{0,128,0} 3. Font Name: Arial 4. Font Size: 10 5. Font Style: Bold 6. Height: 0.197 7. Width:1.361 8. Use System Default: False 9. Decimals: 0 Save the Report At this point your report should look similar to the image below:
Repeat step 13 and make the following changes to the new parameter:
Copyright 2004 Business Objects. All rights reserved.
Page 15
Sponsored Tutorial
EclipseCon 2006
a. b. c. d.
Name: Product Line Prompt Text: Please enter product line Type: String List of Values: Ballpoint Pens
Complete Step 13 one more time to add the 3rd parameter. Make the following changes to the parameter: a. b. c. d. Name: Warehouse Prompt Text: Please enter warehouse Type: String List of Values: Central Warehouse
Once this step is complete save the report. Your list of parameters should now look like the following:
Page 16
Sponsored Tutorial
EclipseCon 2006
Right-click on this object and select New Condition Formula. From the resulting wizard, select the Font Color option from the list This will create a new formula in the Formulas pane of the report editor displaying a list of commented out Color constants. Insert the following formula in this section: if CurrentFieldValue <= {?Highlighting} then crRed else Color(60, 120, 0) Save the Report
Sponsored Tutorial
EclipseCon 2006
Switch to the Properties View and change the Suppress property to a value of True. The selected areas should now have stripes sloping through the section, indicating that it has been suppressed Save the Report
Page 18
Sponsored Tutorial
EclipseCon 2006
Page 19
Sponsored Tutorial
EclipseCon 2006
Once the chart has been configured drag the Sales formula from the Field Explorer view and drop it into the Data Fields box Next drag the REGION_NAME field from the CR_REGION table and drop it on the Series box
Copyright 2004 Business Objects. All rights reserved.
Page 20
Sponsored Tutorial
EclipseCon 2006
Right-click on the newly created Subreport and choose the option to Switch to Subreport. This action will bring the subreport to the forefront of the designer. Now we can add the tables that we want to report off of. In this case we want to add the following tables: CR_EMPLOYEE, CR_ORDER, CR_PRODUCT_ORDER Once the tables have been added create the following links: a. b. CR_EMPLOYEE.EMPLOYEE_ID = CR_ORDER.EMPLOYEE_ID CR_ORDER.ORDER_ID = CR_PRODUCT_ORDER.ORDER_ID
Page 21
Sponsored Tutorial
EclipseCon 2006
Next we will do a little cleanup on the subreport. Suppress every section except for the topmost Report Header area. This should result in only 1 section left for us to work in Now, we will create 2 formulas: a. Formula #1: i. Formula Name: Sales ii. Formula Text: {CR_PRODUCT_ORDER.QUANTITY} * {CR_PRODUCT_ORDER.SALES_PRICE} Formula #2: i. Formula Name: Name ii. Formula Text: {CR_EMPLOYEE.LAST_NAME} & ", " & {CR_EMPLOYEE.FIRST_NAME}
a.
Finally, we will create a new chart in the subreport. As with the main report, drag a Chart icon from the palette and drop it on the Report Header. Make the following modifications to the Charts properties: a. b. c. d. e. f. Chart Type: Pie Subtype: Pie Group Title Text: Region Name Title Text: Sales By Employee Height: 5.292 Width: 8.104
Once the chart has been configured drag the Sales formula from the Field Explorer view and drop it into the Data Fields box Next drag the Name formula from the Field Explorer view and drop it on the Series box Save the report
Page 22
Sponsored Tutorial
EclipseCon 2006
Page 23