Professional Documents
Culture Documents
Table of Contents
1 Creating a Crystal Reports Web Application ..................................................... 2
2 Designing a Report off the Xtreme Embedded Derby Database......................... 11
3 Running a Crystal Reports Web Application.................................................... 20
4 Creating a New Viewer Page ........................................................................ 22
5 Snippets ................................................................................................... 25
6 Help ......................................................................................................... 28
Crystal Reports for Eclipse
Getting Started Guide
3) Click “Next”.
4) Give the project a name in the “Name:” field.
5) Make sure Tomcat is configured with a path to the Java SDK. You should only
have to do this once in your workspace:
PAGE 2
Crystal Reports for Eclipse
Getting Started Guide
PAGE 3
Crystal Reports for Eclipse
Getting Started Guide
PAGE 4
Crystal Reports for Eclipse
Getting Started Guide
h. Click OK.
i. Select “JDK 1.4.2” in the “Installed JREs” list.
j. Click OK.
k. Under the “JRE” field in the “New Server Runtime” dialog, select “JDK
1.4.2”.
PAGE 5
Crystal Reports for Eclipse
Getting Started Guide
l. Click “Finish”.
6) Click “Next >”.
7) The next page of the wizard presents the user with the option select which
“facets” they wish to add to the application. A facet defines which runtime
environments will be added to the application. By default the Crystal Reports Java
Reporting Component will be selected
PAGE 6
Crystal Reports for Eclipse
Getting Started Guide
PAGE 7
Crystal Reports for Eclipse
Getting Started Guide
10) This next dialog allows users to choose whether they wish to add our sample
database and reports as well as a new blank report to their web application
PAGE 8
Crystal Reports for Eclipse
Getting Started Guide
PAGE 9
Crystal Reports for Eclipse
Getting Started Guide
PAGE 10
Crystal Reports for Eclipse
Getting Started Guide
1) After the Crystal Reports Web Project has been created, you should notice that a
file titled CrystalReports1.rpt has been added to the Web Content folder of the
newly created Web Project. Double-clicking this file will open it up in the Crystal
Reports editor. This action should also change the user’s Eclipse Perspective to be
“Crystal Reports”
2) Go to the “Database Explorer”
3) Right-click on the “Connections” node and choose “New Connection…”
PAGE 11
Crystal Reports for Eclipse
Getting Started Guide
4) This action will launch the Database Explorer wizard. Expand the Derby entry in
the Database Manager and select the 10.1 option
5) For the Database location enter classpath:/Xtreme .This will allow the engine to
look for the Derby database within a JAR file located in the CLASSPATH.
6) Set the information in the dialog to the following. For the “Class location”, select
both the derby.jar and Xtreme.jar from your
“.\eclipse\plugins\com.businessobjects.crystalreports.samples_1.0.0.vX
XX\SampleDatabases” directory:
PAGE 12
Crystal Reports for Eclipse
Getting Started Guide
7) The JDBC driver class and Connection URL should be automatically populated.
8) Click “Test Connection” to ensure that you can connect to the database
9) Click “Next”, and then click “Finish”.
PAGE 13
Crystal Reports for Eclipse
Getting Started Guide
10) From the Database Explorer, expand “Xtreme” / “Schemas” / “APP” / “Tables” to
see the available tables
11) Drag the “CUSTOMER” and “ORDERS” tables onto the report. Alternatively, you
can right-click a table and select the option “Add to New Report” or “Add to
Current Report”
12) This will add the CUSTOMER and ORDERS table to the Data pane of the Crystal
Reports editor. Create a relationship between the two tables by dragging the
CUSTOMER_ID field from the CUSTOMER table and dropping it on the
CUSTOMER_ID field on the ORDERS table
PAGE 14
Crystal Reports for Eclipse
Getting Started Guide
13) In the report designer, switch back to the “Layout” tab to begin designing the
report
14) From the Field Explorer, right-click on the COUNTRY field in the CUSTOMER table
and select the option to “Group on Field”. This will group all of the data report
based on Country
PAGE 15
Crystal Reports for Eclipse
Getting Started Guide
15) Repeat this same step to add a group based on the CUSTOMER_NAME field from
the CUSTOMER table. You will notice that Crystal Reports includes pre-existing
logic to decrease the group-level font size as you add more groups. Obviously the
report designer will be able to format these fields as they deem necessary. Your
report should now look similar to the layout below:
PAGE 16
Crystal Reports for Eclipse
Getting Started Guide
16) Now select ORDER_ID, ORDER_AMOUNT and ORDER_DATE from the ORDERS
table. Drag the multiple selection and drop in the Body section of the report. This
will add the 3 data fields to the Body section as well as 3 data labels to the Page
Header section
17) Right-click on the ORDERS.ORDER_AMOUNT field and select the “Summarize”
option
PAGE 17
Crystal Reports for Eclipse
Getting Started Guide
18) This will add a Summary field to the Group1 Footer section.
19) Add some minimal report formatting to adjust the section heights. You can do this
via the Properties view of each section by changing the Height property.
Alternatively, you can drag the height indicator of the section to reduce or
increase the size of the height.
20) Additionally add some text formatting to highlight Group Headings and Total
amounts
21) Click on the “Preview” tab to preview the report. Your report should look similar to
the following:
PAGE 18
Crystal Reports for Eclipse
Getting Started Guide
PAGE 19
Crystal Reports for Eclipse
Getting Started Guide
PAGE 20
Crystal Reports for Eclipse
Getting Started Guide
PAGE 21
Crystal Reports for Eclipse
Getting Started Guide
PAGE 22
Crystal Reports for Eclipse
Getting Started Guide
3) This action will launch a wizard which will provide the Developer with a number of
options. Crystal Reports for Eclipse includes a feature which will auto-generate
stub code to assist developers with coding common tasks (e.g. authenticating
against the database, passing in parameter values, exporting, etc.). There are
additional tutorials available on the Crystal Reports for Eclipse developer zone
which go into this feature in more detail. For the sake of this demo we will select
the default option: “Insert standard Tag Lib code”
PAGE 23
Crystal Reports for Eclipse
Getting Started Guide
4) Clicking “OK” on this wizard will add a new file to the same folder as the report
called “Consolidated Balance Sheet-viewer.jsp”
5) In the Project Explorer, right-click on “Consolidated Balance Sheet-viewer.jsp”.
6) Select “Run As” | “Run on Server”.
7) Select “Apache” / “Tomcat v5.0 Server” and click “Next”.
8) Make sure “CrystalReportsForEclipse” (or whatever you named your project) is
listed under “Configured projects:”, and click “Finish”.
9) This will launch “Consolidated Balance Sheet-viewer.jsp” in an Internet browser
window embedded in the IDE.
PAGE 24
Crystal Reports for Eclipse
Getting Started Guide
5 Snippets
Often developers will want to have more control over the final outcome of their
presentation layer. As mentioned in the previous section Crystal Reports for Eclipse
provides developers with the “Viewer JSP Wizard” to auto-generate custom code to assist
them with the development of applications using our Java APIs. Additionally, this release
also provides a number of code snippets which will allow users to drag-and-drop code
into their JSP page. These snippets provide the developer with more control over where
the code snippet will be generated. The following snippets are provided in this release of
Crystal Reports for Eclipse:
1. Crystal Reports Viewer Tag – this will insert the required Crystal Reports
Viewer Tag Library code. The only parameter required by this snippet is the name
of the report file the viewer should be bound to
2. Open and View Report – This will open the report using the Java Reporting
Component API and view it using the Viewer API.
3. Open Report – This will open the report and create a ReportSource object. This
snippet should be used in conjunction with one of the Viewer or Export snippets
4. View Report – This snippet will add the required Viewer API calls to a page. It
will require a ReportSource object which can be returned from the “Open Report”
snippet
5. View Report and Set Database Logon - This snippet will add the required
Viewer API calls as well as the required calls to authenticate against the database
add runtime. It will require a ReportSource object which can be returned from the
“Open Report” snippet
6. Export Report to PDF - This snippet will add the required exporting calls to a
page. It will require a ReportSource object which can be returned from the “Open
Report” snippet
7. Export Report to RPT - This snippet will add the required exporting calls to a
page. It will require a ReportSource object which can be returned from the “Open
Report” snippet
PAGE 25
Crystal Reports for Eclipse
Getting Started Guide
4) Create a new JSP page (e.g. test.jsp) by right-clicking on the Web Content folder
of the Crystal Reports Web Project and selecting New->JSP
PAGE 26
Crystal Reports for Eclipse
Getting Started Guide
5) Drag-and-drop the “Open and View Report” snippet from the Snippets view to the
JSP page (between the <BODY> tags)
6) Enter “/CrystalReport1.rpt” as the Value for the reportName variable.
PAGE 27
Crystal Reports for Eclipse
Getting Started Guide
7) Click “Insert”. This will insert the code snippet into the source of the JSP page.
8) Test the new JSP by right-clicking on it and selecting the “Run On Server” option.
6 Help
Crystal Reports for Eclipse contains the following Help Guides installed in the Eclipse Help
System:
1. Crystal Reports for Eclipse Designer Guide – this help guide provides
additional information and assistance with using the Crystal Reports editor, such
as built-in formula functions, adding database connections and modifying report
object property values
2. Crystal Reports for Eclipse Developer Guide – this help guide provides
additional developer resources, such as code snippets, walk-throughs and
JavaDocs.
PAGE 28