Table of Contents
We use reports in all aspects of our personal and business lives.
When data is presented in a well organized and informative
manner, such as with business reports, it can significantly
improve our critcal decision making processes. The report
development workflow and MyEclipse Reports tools can be used to
develop a wide range of web report types. In this tutorial we
will walk through the basic workflow for creating, deploying and
testing a simple customer listing web report using the MyEclipse
Figure 1-1 is a screenshot of the completed customer listing
report. You can download the customer listing report project
developed in this tutorial using the Examples On-Demand browser, MyEclipse > Examples On-Demand.
This tutorial assumes the reader is familiar with MyEclipse web
project development and deployment concepts and tools and the
Database Explorer features. If during the course of this
tutorial you have questions or would like further information
about the topics presented in this tutorial please consult the
Resources section for additional
resources. To get a better feel for the full scope of MyEclipse,
please check out our product
This tutorial was created using MyEclipse 6.0.1 Professional Edition. If you are using a more recent version of MyEclipse, most of the images and instructions should be backward compatible.
MyEclipse Reports requires MyEclipse 6.0.1 or above. It is a Professional level feature and is only available to MyEclipse Pro subscribers.
Following is an outline of the task workflow for creating a new
Each of these tasks will be discussed in the order that they are
presented in the outline.
<XXX consider discussing cheatsheets here>
MyEclipse Reports introduces a new type of project known as a
Report Web Project. This type of project is a MyEclipse Java EE
web project enabled with Report development capabilities.
There are two methods for creating a Report Web Project. The
first method is using the Report Web Project Wizard. Consider
using this wizard when you do not have legacy web project
constraints. The second method is to add Report Capabilities to
an existing MyEclipse web project. This method also uses a wizard
but requires the web project already exist before report
capabilities can be added to it. Both appoaches are introduced in
3.1 Using the Report Web Project Wizard
3.2 Adding Report Capabilities to a Web Project
You can Add Report Capabilities to any existing MyEclipse Web project using the Report Capabilities Wizard. This wizard is identical to the wizard page shown in Figure 3-2.
Page-3 of the New Report Wizard allows you to create a sample JSP webpage that demonstrates how to work with the new report. For example the sample JSP page can be configured to either contain a link to your report or embed it. Note: If you choose not to generate a sample report access page at this time you can always generate a page at a later time using the Generate Sample Report Access WebPage action from the report's MyEclipse context menu.
Our customer listing report will retrieve its data from the local
MyEclipse Derby Server. You can use any database for which you
can configure a JDBC driver in the Database Explorer, e.g.,
Oracle, MS SQL Server, etc. The MyEclipse Derby server is provided
as a training convenience as part of the MyEclipse 6 Server
Sandbox and includes a preconfigured JDBC driver.
Working with the Embedded Derby database is covered in this tutorial. If you wish to follow along use a different database, please ensure it is running at this point.
The reportdemo's data source is now configured to fetch its data
using the MyEclipse Derby JDBC driver. For more information about
working with MyEclipse JDBC Data Source see the
Working with MyEclipse
JDBC Data Sources Tutorial.
A data set is a collection of data retrieved from a data source which will be displayed in a report. In this tutorial we will create a SQL data source.
On the second page of the wizard enter a SQL query that will retrieve the data for this data set. As you enter your SQL query the query editor supports content-assist of schema and table names. You may also double click a table or column in the tree view to have the qualified name of that element automatically inserted into the query at the last place of editing.
With the data source and data set created, the next step is to add the user interface elements to the report that will display the data from the Customers data set. We will start by adding a table element to the report. Then we will bind columns from the data set elements to the columns in the report table. It is important to understand the functionality that the table provides:
In Figure 7-6 we can see in the report preview that data rows are displayed in the order that they are returned by the Customers data set query. The default data row ordering can be influenced by many factors, such as the order in which data was created in the database. In most cases, you will want to change the order in which data appears in the report. This section will introduce how to sort report data.
Now that the report displays the data in the correct order, we can turn our attention to improving the report's appearance. In this section we will perform the following tasks:
7.3.1 Edit Column Heading Labels
7.3.2 Format Column Head Labels
To format a report element, you set its properties. You can accomplish this task in two ways:
In this procedure, we will use the first method, Property Editor, to set the column headings to bold. The second method will be used add color to the header row.
Figure 7-12, New Style Editor
Figure 7-13, Guide cells at top and left of a table
Figure 7-14, Report preview with improved header row styling
7.3.3 Display First and Last Names on Same Line
When you place multiple elements in a single cell, MyEclipse Report Designer creates block-level elements. If you are familiar with HTML, you know that each block element starts on a new line. To display multiple elements on the same line, you need to set them as inline elements. Alternatively, you can concatenate the first and last name values to display in a single data element, as described in this procedure.
Edit Data Item Binding, shown in Figure 7-15, provides information about the data associated with the current data element. In Expression, dataSetRow["CONTACTFIRSTNAME"] indicates that the data element displays data from the CONTACTFIRSTNAME field in the data set.
Figure 7-15, Edit Data Binding
The edited expression appears in Edit Data Item Binding. Choose OK to save the changes to the data element.
7.3.4 Increase Space Between Rows
The default layout adds minimum space between table rows. Typically, you will want to adjust the spacing between rows.
To wrap up our report needs a title. To display a title, you can use either a label element, a text element, or a data element:
In this procedure, you use a text element and HTML tags to format the text. Note that you are not required to use HTML to create formatted text. If, however, you are well-versed in HTML or web design, you might prefer using HTML to create a block of formatted text.
Figure 7-21, Text with HTML Tags
With the report designed and styled, the next step is to deploy to a web server and test the reports operation using a web browser. For this tutorial we will deploy the reportdemo project to the embedded MyEclipse Tomcat server.
Because a report web project is an extended web project with report capabilities, it may be deployed to any J2EE web server. Please see the MyEclipse Deployment tutorial for more details on setting up and deploying to other web servers.
You have just built your first report and learned about many of the basic tools and features of the MyEclipse Report Designer. There are many more tasks that you can accomplish to build more sophisticated reports. Some of these tasks, described in other chapters include:
Below, we would provide you with more information
pertaining to the topics covered in this tutorial. We realize we can't cover
every question you may have in one tutorial, but between this
tutorial contents and our additional learning resources we hope
you are well on your way to developing your own custom reports.
We would like to hear from you! If you liked this tutorial, has some suggestions or even some corrections for us please let us know. We track all user feedback about our learning material in our Documentation Forum. Please be sure to let us know which piece of MyEclipse material you are commenting on so we can quickly pinpoint any issues that arise.
<copyright notice about actuate and genuitec>