Creating a basic report
This section will give you the basic understanding in creating a report from a database in Eclipse.
To create a basic report from the database
- On the File menu, click New > Other….
The New wizard opens.
- Expand the Crystal Reports node, select Blank Report, and click Next.
- Select the CrystalReportsDemo > WebContent node.
- In the File name field, type
BikeSalesReport.rpt.
- Click Finish.
- In the Database Explorer view, go to Connections > classpath:/Xtreme[Derby 10.1] > classpath:/Xtreme > Schemas[Filtered] > App > Tables.
- Expand the Tables node.
- Right-click the CUSTOMER table and click Crystal Reports > Add To Current Report.
- Right-click the ORDERS table and click Crystal Reports > Add To Current Report.
The report switches to the Data view in the Crystal Reports editor.
- Drag the CUSTOMER_ID field from the CUSTOMER table and drop it on the CUSTOMER_ID field on the ORDERS table to create a relationship between the two tables.
- In the Crystal Reports editor, switch back to the layout view.
- In the Field Explorer view:
- Expand the CUSTOMER node, right-click COUNTRY: String[30] and click Group on Field.
GroupName ({CUSTOMER.COUNTRY}) appears on the Group1 section of the report layout.
- Right-click CUSTOMER_NAME: String[40] and click Group on Field.
GroupName ({CUSTOMER.CUSTOMER_NAME}) appears on the Group2 section of the report layout.
- Expand the ORDERS node, select ORDER_AMOUNT: Number, ORDER_DATE: Date, ORDER_ID: Number fields and drag them to the Body section of the report.
ORDERS.ORDER_AMOUNT, ORDERS.ORDER_DATE and ORDERS.ORDERS_ID appear on the Body section of the report layout. ORDER_AMOUNT, ORDER_DATE and ORDER_ID appear on the Page Header section and the Body section of the report layout.
- In the Crystal Reports editor, right-click ORDERS.ORDER_AMOUNT and click Summarize.
A summary field appears on the Group1 footer section of the report layout.
- Adjust the layout of the report by dragging the fields on the layout view of the Crystal Reports editor.
- Save the report.
- Switch to the Preview view to view the report.