jreport designer - getting started - logi analytics

48
JReport Designer - Getting Started

Upload: others

Post on 23-Apr-2022

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: JReport Designer - Getting Started - Logi Analytics

JReport Designer − Getting Started

Page 2: JReport Designer - Getting Started - Logi Analytics

Table of ContentsGetting Started: Organization of This Part ........................................................................................................................1

First Step...............................................................................................................................................................................3What You Should Already Know...............................................................................................................................3Target Customers......................................................................................................................................................3Where to Find More Information or Get Help............................................................................................................3General Installation Information................................................................................................................................4

JReport Designer Basics.....................................................................................................................................................5Configuration and Customization..............................................................................................................................5Setting up a Connection............................................................................................................................................5Working on a Catalog................................................................................................................................................5Report Development and Editing..............................................................................................................................5Reporting Properties.................................................................................................................................................5Report View and Printing...........................................................................................................................................6Extensibility and APIs................................................................................................................................................6Product Integration....................................................................................................................................................6Exporting Information................................................................................................................................................6

Features Overview ...............................................................................................................................................................7JReport Basic Concepts............................................................................................................................................7100% Java.................................................................................................................................................................8Crossing Platforms....................................................................................................................................................8Full−Featured & Easy−to−Use Report Designer.......................................................................................................9

Intuitive Main Working Environment.............................................................................................................9Catalog Browser...........................................................................................................................................9Report Inspector.........................................................................................................................................10Report Wizard............................................................................................................................................12Query Editor...............................................................................................................................................12Report Manager and Data Manager...........................................................................................................13Template and User Defined Template........................................................................................................14Catalog Doctor − Problem Diagnosis Tool.................................................................................................14

Catalog − Resources Repository.............................................................................................................................15Flexible Connection to Data Sources......................................................................................................................15Professional Reporting Tools..................................................................................................................................15

Nested Dynamic Group/Sort.......................................................................................................................15Multiple Sub−reports and Sections.............................................................................................................15Conditional Formatting...............................................................................................................................153D Graphs and Charts...............................................................................................................................16Cross−tabs.................................................................................................................................................16RTF Texts...................................................................................................................................................16Drill−down Analysis....................................................................................................................................16Hyperlinks...................................................................................................................................................16Image File Input..........................................................................................................................................16UDF − User Defined Formula Functions....................................................................................................16UDO − User Defined Object.......................................................................................................................16Exit Method − Call Back Method During Report Running Process............................................................16National Language Support........................................................................................................................16Page Level Security...................................................................................................................................17

Delivery of Reports..................................................................................................................................................17Pipeline Output Stream..............................................................................................................................17Multiple Export............................................................................................................................................17E−mail Report Delivery...............................................................................................................................17Deploying Catalog and Report Source File................................................................................................17

Designing, Running and Viewing Reports Programmatically..................................................................................17JReport Designer API.................................................................................................................................17

I

Page 3: JReport Designer - Getting Started - Logi Analytics

Table of ContentsJReport Catalog API...................................................................................................................................17JReport Engine Bean.................................................................................................................................18JReport Result Viewer Bean......................................................................................................................18JReport Catalog Bean................................................................................................................................18

Quick Tour ..........................................................................................................................................................................19Products Roadmap..................................................................................................................................................19Designing a Report with Report Wizard..................................................................................................................21Testing Your Report................................................................................................................................................32Designing, Running and Viewing a Report Programmatically.................................................................................34

JReport Designer API.................................................................................................................................34JReport Engine Bean.................................................................................................................................35JReport Result Viewer Bean......................................................................................................................35

Delivering Reports...................................................................................................................................................36Export Report Result to HTML...................................................................................................................36Deploying a Report.....................................................................................................................................37

Remote Access of JReport Enterprise Server.........................................................................................................37Using Browser............................................................................................................................................37Client Viewer Bean.....................................................................................................................................42

Demo Reports.........................................................................................................................................................43

II

Page 4: JReport Designer - Getting Started - Logi Analytics

Getting Started: Organization of This PartThe Getting Started book provides an introduction to JReport. It covers issues associated with installation, setup, andconfiguration of JReport. It is a combination of informational topics and strategic references to various topics in the User'sGuide and User Reference books. The Getting Started book contains the following chapters:

First Steps: Preliminary knowledge you should know to use JReport Designer effectively, general installation andconfiguration information as well as where to get more help.

JReport Basics: JReport basic concepts and overall architecture, all aspects of tasks and commands you willmost often perform while using JReport Designer.

Features Overview: High−level overview of JReport Designer's major features, so that you can evaluate whetherJReport is the right tool for you.

Quick Tour: A summary/work flow of JReport reporting solutions, giving you a very quick and betterunderstanding of scenarios to which JReport Designer can be tailored.

JReport Manual Roadmap

The following picture lists the other books in the JReport Designer manual, JReport Enterprise Server manual andJREntViewer manual, and the relationship between them. You are advised to start with the JReport Designer manual.With some report designing knowledge, it is easy to learn JReport Enterprise Server in the server/client architecture.

JReport Designer manual includes four books: Getting Started, Tutorial, User's Guide, User Reference.

JReport Enterprise Server (abbreviated as JREntServer) manual includes three books: Getting Started, Tutorial, User'sGuide. In addition, the JREntViewer manual is for using JREntViewer with JREntServer.

For a complete coverage of the features, operations and other information, please refer to the specific book:

JReport Designer TutorialBasic report building instructions. This includes reporting features that you will find useful. The idea is that after you havewalked through this Tutorial, you will easily follow the examples and build your own reports. For in−depth featurecoverage such as building reports on XML, EJB, stored procedure, SQL file, please refer to the User's Guide.

JReport Designer User's GuideIn−depth coverage of JReport Designer's features and generally explains how to use the product. Browse to locate the

1

Page 5: JReport Designer - Getting Started - Logi Analytics

chapters that are of interest to you for step−by−step instructions.

JReport Designer User ReferenceSpecifications, providing technical, system and other reference information related to JReport built−in objects, built−informula functions and APIs.

JREntServer Getting StartedAn introduction to JReport. It covers issues associated with installation, setup, and configuration of JReport EnterpriseServer. It describes most informational topics and references in the JREntServer User's Guide.

JREntServer TutorialBasic Server configuration, administration and accessing instructions. After walking though this tutorial, you will be ableto use the server for managing the interaction between client and server that enables activities such as scheduling andrunning reports.

JREntServer User's GuideProcedures to get a more in−depth understanding of JREntServer. Inclused are steps for advanced server features suchas JSP, national language support, server API, application server integration, JReport (Client) Viewer Bean.

JREntViewer ManualComplete coverage of features and instruction of using JREntViewer with JREntServer. Client API usage is introducedin this book.

Index

Getting Started: Organization of This Part

2

Page 6: JReport Designer - Getting Started - Logi Analytics

First Step

What You Should Already Know

The main purpose of these JReport documents is to explain how to use products. However, we assume that you alreadyknow:

How to install JVM and launch an application with it.• The expected reports based on your data source.• Your external tools and systems such as IDE's, version control systems, database management systems(DBMS), application servers.

Your target programming languages.•

Target Customers

JReport gives every type of user a level of functionality suited to their needs. We have a visual design and deploymentenvironment compatible with various tools. In addition, application developers can also take advantage of a full set ofAPIs. The two approaches complement each other. Our target customers include:

End users without any programming experience• Internet and Intranet web site developers• IS Project Managers• Programmer/Analysts• Managers of End−user Computing•

Where to Find More Information or Get Help

Rapid changes in various technologies used to develop JReport sometimes cause certain help documents to becomeoutdated, even between releases. To keep you current, the latest information is always posted on the Jinfonet website.

Homepage: http://www.jinfonet.com/

Contents:

Products and release information:www.jinfonet.com/products.htm

Products download center:www.jinfonet.com/webpage/support/download.htm

Docs and Tutorials:www.jinfonet.com/webpage/kbase/kbase.htm

Manual related materials:www.jinfonet.com/webpage/kbase/kbase.htmGo to the Manual related materials for JReport Designer. This includes some demo reports, example sourcecode file and other files you will need to follow our instructions for a feature. Also, if you have installed JReportHelp (HTML version), you can find them on your local drive under %manual−installroot%\pro−material\.

JavaDoc for APIs provided in JReport Designer:www.jinfonet.com/webpage/kbase/kbase.htmGo to JavaDoc for JReport Designer. The APIs include JReport Engine Bean, JReport Result Viewer Bean,JReport Catalog Bean, JReport Designer API, JReport User Data Source, JReport Printable (for IBMSanFrancisco), JReport Exit Function, JReport User Defined Formula, JReport User Defined Object.

JReport technical support center:www.jinfonet.com/support.htm

News and release notes:www.jinfonet.com/webpage/news/recent.htm

3

Page 7: JReport Designer - Getting Started - Logi Analytics

www.jinfonet.com/webpage/news/news.htm

Problem Reporting (for JReport Designer):

If you are having trouble running JReport Designer or encounter any problems during reporting, use the following stepsto troubleshoot it yourself first.

Check whether your system meet the requirements, see User Guide | Installing and Launching JReport Designer.1. Configure JDBC drivers. JReport Designer supports:

a. Database connections via various JDBC drivers.b. ODBC data sources via Sun's JDBC−ODBC bridge.

Note: You need to install the JDBC or ODBC driver before installing JReport Designer. For more informationabout how to install the driver please refer to the appropriate JDBC or ODBC manuals.

You can specify JDBC drivers in two ways: a. Specify the JDBC driver's Java class name in the Connect dialog box.b. Edit c:\JReport\bin\jdbcdrivers.properties, in which one or more JDBC drivers can be specified:jdbc.drivers=foo.bah.Driver:wombat.sql.Driver.

2.

Please refer to www.jinfonet.com/hotfixes/Faq.htm for frequently asked questions and their solutions.3.

However, if the problem persists, report it to Jinfonet Support ([email protected]) with the following information:

Describe the precise steps leading to the problem.• Run the batch file called "jrenv.bat" under the %installroot%\bin subdirectory. By running this batch file, a filecalled "report.env" will be generated in the current directory. Send this file to us.

Send us the catalog file (*.cat and*.fml) and the report file *.cls that you are having problem with.• Start JReport with the batch file DJReport.bat. By running this batch file, a log file JReport.log will be generatedin the current directory. Try to reproduce the problem, and send this log file to us.

In order to resolve a reported technical issue, we need to access your report data so that we can recreate andanalyze the problem. Regardless of the size of your database, we only require access to the data returned by thequery of the particular report. We will be happy to execute a confidentiality agreement with you if necessary.To extract the report data, in Catalog Browser, right click on the query that your report is using, select the menuitem 'Create Cached Query Result', input the data file name and click the 'Save' button. The query result will besaved in the file. Send us all the files <file name>.* (including the description file also). If the main report containssub−report(s), repeat this process for each sub−report.

General Installation Information

JReport installation is designed to be easy and straightforward. All installers for all products provide a "wizard" to guideyou through the process. Detailed installation information and start−up steps for all platforms are provided in the user'sguide for each product.

To download the installation file, go to our download center at http://www.jinfonet.com/webpage/support/download.htm.To install the product, you first need to register to obtain your evaluation key. The registration form is located athttp://www.jinfonet.com/JReportRegister.htm. The full−featured product can be used for 30 days free of charge.

Index

First Step

4

Page 8: JReport Designer - Getting Started - Logi Analytics

JReport Designer BasicsThis chapter provides common tasks and operations in different areas of JReport Designer. Each task or topic is coveredin the book JReport Designer − User's Guide.

Configuration and Customization

DataSource setupSupplement the necessary classpath option for any external .class files in the batch file

Setting up a Connection

Create a new CatalogSetup a Connection to connect with the data sourceSQL file importingDirectly import user data source to the catalogEJB, XML data sources with ModelWizard

Working on a Catalog

Create/modify a Query or UDSCreate/modify objects such as parameter, formula, and summary.Create/modify customized objects such as sub−report, chart, line, print dates.Copy and paste functions on a formula and queryReport management and Data managementSave a catalogSave as a catalogDeploy a report locally or to JReport Enterprise Server with Deploy Wizard

Report Development and Editing

Create a new report, using Report WizardChoose from various report templatesUser defined templateVertical/horizontal page breakGrouping, sorting, sumParameters, formulas, DB−fieldsRTF text objectCross−tab report, Sub−report, Embedded Sub−reportChart/graph, drill−down on summary

Reporting Properties

True type fontCondition format (formula control of formatting)Dynamic group/sortReport Deploy WizardNational Language SupportMaximum Records for displayCompressed report result fileStyle SavingUnderlaySuppressed, invisible, suppress blank sectionWordwrap, autofit

5

Page 9: JReport Designer - Getting Started - Logi Analytics

On new page, fill whole page

See also: Individual objects have reporting features of their own. Detailed information can be found for each object in thebook "User Reference".

Report View and Printing

Paper, orientation, marginsTable of contentsDynamic sortZoom in/outPrinting

Extensibility and APIs

UDO: User Defined Object and tool − UDO MakerUDF: User Defined FunctionsUDS: User Data SourceExit MethodsJReport Designer API − Design a report programmaticallyJReport Catalog API − Create and modify a catalog programmaticallyJReport Engine Bean − Run report within user applicationsJReport Result Viewer Bean − View the report result generated by JREngine within user applicationsJReport Catalog Bean − Manipulate and access the catalog of JReport

Product Integration

Other web servers integration: WebLogic, SilverStream, WebSphere, Apache, Java Web Server, IIS, NetscapeApplication Server (for JReport Enterprise Server)WebSphere Business Components (SanFrancisco)JBuilder 3Forte for JavaVisual Age Visual CaféISV Integration − Novell

Exporting Information

Report result fileEmail notificationReport via Email attachmentsAppletHTMLPDFXLSRTFPostscriptPlain textX character separator formats CSV TSVXML

JReport Designer Basics

6

Page 10: JReport Designer - Getting Started - Logi Analytics

Features OverviewThis section presents a run−down of JReport's top features and gives you some basic information about each one.These topics are intended to give a high−level overview. You can find detailed information in the User's Guide, whichcontains how−to steps for trying out a feature. Browse the table of contents of the User's Guide of JReport Designer, andyou will easily locate the feature you are interested in. However, first reading the basic ideas that JReport presents to youhere you will better understand and use JReport with your own systems.

JReport Basic Concepts

In a typical business, the reporting system is responsible for making suitable information ready for the informationconsumer. JReport gives you powerful and easy−to−use ways to extract, analyze and present data in reports anddistribute those reports to the right people.

JReport is a reporting solution written in 100% pure Java, it covers the whole process including fetching data, analyzingdata, presenting information, distributing the result and finally printing the result.

Jinfonet Reporting Suite (including JReport Designer and JReport Enterprise Server) is a Java™−based businessintelligence tool, used for database query, reporting and analysis. JReport Designer is the client−side report designingand developing tool. Reports developed can be deployed to JReport Enterprise Server for running in the server/clientmode. In this sense, JReport is particularly well suited for Internet and intranet deployment by virtue of being written100% Java and due to its flexible client/server architecture.

Overall Architecture:

7

Page 11: JReport Designer - Getting Started - Logi Analytics

Key benefits:

Object oriented for reusability. Components defined once can be used over and over again in differentconfigurations to create different reports.

Database independent. • Easy and intuitive. The focus is on creating a report generator that anyone can learn to use easily, but that canbe customized in a multitude of ways for the experienced professional.

Web enabled. Reports generated with the report writer can be accessed from Web pages, either through anembedded applet, via HTML, or via PDF.

Platform independent. By virtue of being built in Java, this product can run on any Java enabled platform. • Full−featured. The report writer should provide all of the expected functionality for a first rate report writer, and inaddition, object oriented features that allow users to subclass existing reports and report components.

100% Java

Utilizing the full advantages of Java architecture, JReport works with any platform, any OS, any database, any webserver and any browser. Dynamic portability, low administration costs and dynamic upgrades are key advantages thatare inherent to JReport’s unmatched capabilities.

Crossing Platforms

JReport Designer and JReport Enterprise Server are Java−centric object−oriented reporting tools written entirely in Java.JReport supports JDK 1.1, JDK 1.2 and now JDK1.3. Besides JDK, it works with JRE or Microsoft Java VM. With Java'scross−platform portability, JReport can run on virtually any platform.

Features Overview

8

Page 12: JReport Designer - Getting Started - Logi Analytics

Full−Featured & Easy−to−Use Report Designer

Intuitive Main Working Environment

JReport Designer main window provides an intuitive and friendly design environment, which supports a point−and−click,drag−and−drop WYSIWYG interface. You can select the options from the main menu or press the buttons on thetoolbars to perform actions. In addition, a variety of formatting commands, ranging from changing color background orforeground, to saving object styles can make your report more informative and visually appealing. The runtime Viewerprovides drilldown capabilities for reports that allow end users to interactively explore associated data.

Catalog Browser

Features Overview

9

Page 13: JReport Designer - Getting Started - Logi Analytics

You can define the catalog using Catalog Browser. All of the resources are organized on tabs and trees.

Report Inspector

Features Overview

10

Page 14: JReport Designer - Getting Started - Logi Analytics

Properties and values of all objects in a report are displayed in a property sheet for you to view and change interactively.The properties for different objects in Report Inspector are displayed dynamically. Commonly used properties for anobject include:

Underlay, linkSuppressed, invisible, suppress blank sectionWordwrap, autofitOn new page, fill whole pagePatternStyleFontFace, FontSize, Underline, Bold, Strikeout, AlignmentBorder width, borderline

Many properties can be controlled dynamically by a formula .

Features Overview

11

Page 15: JReport Designer - Getting Started - Logi Analytics

Report Wizard

Interactive tools are provided to build typical reports including tables, labels, statements, crosstabs, form letters andgraphs. Reports can also be created from scratch by dragging & dropping report objects.

Query Editor

Query Editor lets you join tables and set the conditions simply through point−click and drag and drop.

Features Overview

12

Page 16: JReport Designer - Getting Started - Logi Analytics

Report Manager and Data Manager

You can categorize reports in Report Manager.

The Data Manager controls data retrieval, including number of rows to be displayed and the duration required forretrieval. The Data Manager can also keep the access information in previous runs of a query.

Features Overview

13

Page 17: JReport Designer - Getting Started - Logi Analytics

Template and User Defined Template

A template is an abstract and simplification of a report file. JReport can translate and expand a template to build acomplete report file. JReport can build different reports based on the same data by using various templates. You canchoose the templates supplied by JReport or design templates according to your own need.

Templates provided include: invoice, crosstab, subreport, HBlank (horizontal page break), standard, drop table.

Catalog Doctor − Problem Diagnosis Tool

The Catalog Doctor maintains the validity of the resources in your catalog. For example, when you delete a column inyour database, you need to update your tables formulas and queries which reference the column so that the report canbe run correctly.

Features Overview

14

Page 18: JReport Designer - Getting Started - Logi Analytics

Catalog − Resources Repository

JReport catalog file contains object definitions that are used by reports in the catalog. Also, components available forbuilding your report, including data source, queries, formulas, parameters, and various data and drawing objects, areavailable for you to pick and drop into your report. All of the resources can be shared among reports. Here are someimportant objects and their usage:

Parameter: A variable whose value is an input value at run time. It plays an important role in dynamic controlreporting at runtime to filter records, and display text on the fly.

Formula and summary are objects to be computed at run time, and allow you to manipulate field data byperforming calculations, controlling the data to be displayed, and even creating new data not directly availablefrom a database. Summary is a special formula.

Customized Object: These objects can be customized with their own properties such as color, and length. beforebeing inserted into a report.Drawing objects: line, box, round box, arc, oval, label, image.Special fields: user name, print date, print time, fetch time, modified data, modified time, record number, groupname, group number, total group number, page number, total page number, SQL statement.

Flexible Connection to Data Sources

A Connection is a listing of the database objects which are accessible through JDBC or JDBC−ODBC Bridge. If you wantto use tables, views, stored procedures and other objects stored in database, you need to connect the objects to theCatalog Browser. Furthermore, you can create the imported queries from an existing SQL file.

In addition, JReport can also access data from the user's application through a Data Source Driver. The Data SourceDriver described in this document is designed to extend JReport's ability of accessing data. Using the Data SourceDriver, users can produce reports by providing data from user's programs or any external sources. The Data SourceDriver is a Java class that provides the data set to JReport when the report is generated at the runtime. Normally, thereport engine gets the report data set from the JDBC calls with SQL statements. When the report uses the Data SourceDriver, the report engine gets the data set from the Data Source Driver. In other words, the Data Source Driver is analternative to the JDBC calls.

In a word, JReport is open to data. JReport Engine supports multiple data source types: XML, EJB, JDBC/ODBC(including commonly used databases like Access, Oracle, Sybase, SQL Server, Informix, IBM DB/2 and more), plain textor any user data source.

For JDBC/ODBC, we also support stored procedure and SQL file input.

Professional Reporting Tools

Nested Dynamic Group/Sort

You can make a multi−level nested group/sort report by selecting fields as grouping/sorting criteria under Group/SortWizard. In addition, you can define the group/sort criteria in run time, that is, you can using Dynamic group/sort.

Multiple Sub−reports and Sections

JReport products allow you to insert sub−reports and sections at any time.

Conditional Formatting

You can flag field values, suppress fields etc. that meet certain conditions by formatting the field conditionally. This isdone by setting a property value to be controlled by a DBField or a formula field, rather than a constant value.

Features Overview

15

Page 19: JReport Designer - Getting Started - Logi Analytics

3D Graphs and Charts

You can insert Charts and graphs into any report to show data using Charts/Graphs Wizard.

Cross−tabs

A Cross Tab is an object that summarizes data and presents the summaries in a compact row and column format. Thisallows comparisons and identification of trends to be displayed. You can insert the Crosstab object using the Cross−tabWizard.

RTF Texts

Text Object supports basic rtf properties, such as font color, size, picture, paragraph alignment. You can also insertdatabase fields, formula fields and parameter fields into it.

Drill−down Analysis

You can drill down on Aggregate level fields, a component of chart objects for analysis.

Hyperlinks

You can use Hyperlink UDO objects to create hyperlinks.

Image File Input

Images (bmp, gif, jpg) can be directly inserted into a report or underlain as the background. We also support imagesstored in a database as with a common database field (termed as DB−Field).

UDF − User Defined Formula Functions

JReport has provided a number of built−in formula functions for users. However, if these functions still cannot satisfy yourneeds, you can design your own formula functions according to your requirements. We provide user−defined formulafunctions for implementing it.

UDO − User Defined Object

User Defined Objects extend JReport with new object types. A user defined object (UDO) is an object inherited fromJReport's system object. A user can add and modify new properties, as well as use other existing methods. They canspecify new methods for modifying the properties of their UDO. The UDO can be inserted into JReport system as if itwere a regular JReport Object. The UDO then become a part of the report created by JReport system.

Exit Method − Call Back Method During Report Running Process

JReport has developed three Exit functions for users: BeforeRun, AfterRun and AfterInitParameter. These functionsenable you to develop your own actions that can be called before, after or during the process of running a report.

National Language Support

A report file can be deployed to JReport Enterprise Server for running in the client/server scenario, where different clientsselect different languages for the corresponding rendering of the report (for language−dependent text of Label object).

Features Overview

16

Page 20: JReport Designer - Getting Started - Logi Analytics

Page Level Security

Beginning with Version 4.0, JReport support page level security which creates a security mechanism for controllingaccess to the report. After a report is deployed to the JReport Enterprise Server, different users can view different groupsaccording to their access privilege.

Delivery of Reports

Pipeline Output Stream

To optimize performance, JReport Designer can view report pages before they are completely generated.

Multiple Export

JReport products can generate the result file in many different formats. For example, a Report Result file can be viewedwith JReport viewer, PDF, HTML, XML, RTF, APPLET, Excel and Standard Data Format (CSV, TSV),.

E−mail Report Delivery

You can email notice when JREngine runs the report. Report results or various outputs can be attached with the mail andsent directly to the addresses.

Deploying Catalog and Report Source File

You can deploy your catalog files and report files to another location on the local drive or to JReport Enterprise Server forrunning in the server/client mode.

Designing, Running and Viewing Reports Programmatically

JReport Designer gives the developer the option to develop complete reports visually. The designer in JReport Designerprovides a friendly GUI to allow easy design of reports. You click the View tab to make the JREngine run the report. Thenthe report result will be shown in the viewer. Visual designer drastically increases productivity by allowing users to designa complete report right inside the visual environment. This doesn't mean the programmatic approach has beenabandoned. Actually the two approaches can nicely complement each other.

JReport Designer API

Almost all the design work can be achieved within your application. The way of editing and refining a report with theDesigner API is just like that in JReport Designer. Using Designer API, you can edit the layout of a report by changingproperty values, or modify the report by inserting objects such as DBfield, formula, text object, chart. Also based on theexisting catalog and query, you can create and design a report with Designer API.

Our IDEs include JBuilder, SilverStream, Visual Age, Visual Café, Forte and more.

JReport Catalog API

Catalog API allows you to utilize programming to manipulate a catalog. You can create or edit a catalog with the methodsprovided by Catalog API instead of using the GUI design mode in JReport Designer.

The combination of Catalog API and Designer API provides you with a Java development environment that enables youto create any report to meet your needs.

Features Overview

17

Page 21: JReport Designer - Getting Started - Logi Analytics

JReport Engine Bean

You use JReport Designer to build a report/template, and save the report file as .cls file. Then call JReport Engine Beanin your own application to generate report results and export the results to other formats like PDF, Text, HTML and Rst,or to a printer for printing.

With the robust JReport Engine, you can set runtime options to run the report result. You can set the where portion, setparameter values, even set new connection to access a different database with the exact same table structure.

JReport Result Viewer Bean

The report result (physical file or the report result set) can be viewed with the JReport Result Viewer locally. The viewercan also export the result to other formats such as PDF, Text, HTML and Rst, or to a printer for printing.

JReport Catalog Bean

Report Catalog Bean provides a programming API to manipulate and access the catalog of JReport. The catalog is usedto hold all the resources that are used to build a report in JReport.

Create an empty catalog.• Add objects to catalog. • Remove objects from catalog. •

Features Overview

18

Page 22: JReport Designer - Getting Started - Logi Analytics

Quick TourThis chapter covers a summary/ work flow of JReport reporting solutions, giving you a very quick and betterunderstanding of scenarios to which JReport Designer can be tailored. For more details about how JReport Designerworks, please refer to Tutorial and User’s Guide.

Products Roadmap

The following diagram represents the current structure of JReport products.

Now let us dissect the above figure and give you a detailed explanation for each part.

The first part is the report designing process. That is, you use JReport Designer to design reports. JReport Designerbasically contains three components: designer, engine and viewer. The designer in JReport is easy−to−use andfeature−rich. The resources (data source connection, table, query, formulas.) a report uses are saved as catalog file(.cat), and the Report file is saved with the .cls extension. To view the report is to initiate JReport Engine to run thereport, fetch the data and return the report results. Report results will then be displayed in the viewer.

19

Page 23: JReport Designer - Getting Started - Logi Analytics

The designing, running and viewing reports processes as discussed above can also be achieved programmatically.When you install JReport Designer, the archive files for the three have also been installed−−JReport Designer API,JReport Engine Bean and JReport Result Viewer Bean. They function exactly the same as if you were operatingwithin the GUI of JReport Designer, only that you call them in your own applications. Here a .cls file is saved with JReportDesigner, or you create one with the Designer API. The report result that JReport Result Viewer Bean recognizes can bethe result file generated with JReport Designer, JReport Engine Bean or JReport Enterprise Server. In other words, thereport result is essentially generated by JReport Engine.

Once reports have been developed by various end users, you may want to manage them in a server and run them on ascheduled−basis or on−demand. JReport Enterprise Server (JREntServer) is once again at your service. Designed asan integratable reporting solution for multi−tier architecture, blending the best of Java and Web, and based on our robusthigh−performance report engine, JReport Enterprise Server can be used as a component in your Intranet and Internetinfrastructure.

Whether our server runs as a standalone server or a servlet inside web servers, reports deployed are run by JREngineon demand or on a schedule requested by any client. Report results or output of their formats is then transferred to the

Quick Tour

20

Page 24: JReport Designer - Getting Started - Logi Analytics

clients. JReport Enterprise Viewer (JREntViewer) is the client viewer for working with JREntServer. We also have theJReport Viewer Bean (different from JReport Result Viewer Bean which runs in standalone mode). This means theclient command for running reports can be done with your own code. Of course, without any requirement for your webbrowser (IE or Netscape), you can directly access JREntServer.

Designing a Report with Report Wizard

In this chapter, you will learn a simple example of how to create a quick report using the Report Wizard. Each stepexplained here is in brief. If you would like to know more details, please refer to User's Guide | Developing Reports withReport Wizard.

Go to our Web site at http://www.jinfonet.com/webpage/support/download.htm to download JReport Designer.Register in the registration form at http://www.jinfonet.com/webpage/support/register.htm to get the evaluationkey.

1.

Install JReport Designer. 2. Start JReport Designer with the batch file %installroot%\bin\JReport.bat. 3. Choose a template, such as Standard on the New tab in the Open Report dialog.4.

Quick Tour

21

Page 25: JReport Designer - Getting Started - Logi Analytics

Preview the overall format of the template you selected by pressing the Show Template button.5.

If satisfied with the template, go through Report Wizard to create a report step by step.6.

Quick Tour

22

Page 26: JReport Designer - Getting Started - Logi Analytics

Data − Select the data source from all data objects to form a Working Set.

Joins − Join multiple tables using JReport Designer's default settings or manually.

Quick Tour

23

Page 27: JReport Designer - Getting Started - Logi Analytics

Conditions − Specify the criteria which will retrieve data from the database to form the query of the report.

Quick Tour

24

Page 28: JReport Designer - Getting Started - Logi Analytics

Display − Select which fields to show in the report.

Quick Tour

25

Page 29: JReport Designer - Getting Started - Logi Analytics

Group − Enter the criteria to define multi−level groups and specify the ordering of the groups.

Quick Tour

26

Page 30: JReport Designer - Getting Started - Logi Analytics

Sort − Sort records within the groups and select the sorting fields.

Quick Tour

27

Page 31: JReport Designer - Getting Started - Logi Analytics

Summary − Specify summary functions.

Quick Tour

28

Page 32: JReport Designer - Getting Started - Logi Analytics

Other − Preview the selection you have made in Report Wizard and make adjustments.

Quick Tour

29

Page 33: JReport Designer - Getting Started - Logi Analytics

Style − Choose in which layout and style you want your data to be placed.

Quick Tour

30

Page 34: JReport Designer - Getting Started - Logi Analytics

After going through Report Wizard, you will get a draft report. To make it professional, a lot of refining workneeds to be done with Report Inspector. Please refer to User's Guide | Refining the Report Layout for moredetails.

7.

Quick Tour

31

Page 35: JReport Designer - Getting Started - Logi Analytics

Save your report design.8.

Testing Your Report

Click the View tab in the following report window to test the report result you just created.

Quick Tour

32

Page 36: JReport Designer - Getting Started - Logi Analytics

Click the View tab and get the result as shown partially below.

Quick Tour

33

Page 37: JReport Designer - Getting Started - Logi Analytics

Designing, Running and Viewing a Report Programmatically

Just now you designed a report with the designer, and saved the report file as .cls file. When you run the report withinJReport Designer, JReport Engine will connect with the data source to fetch the data, so that you can view the reportresult in the viewer. The above three processes can be achieved within your application. We provide Designer API,JReport Engine Bean, JReport Result Viewer Bean.

JReport Designer API

import java.io.*;import java.awt.*;

import jet.api.*;import jet.jetc.*;import jet.universe.exception.*;

desg = new Designer(path, cat);desg.setLog(new FileOutputStream(log), "8859_1");

//Opening an Existing Reportreport = desg.open(name);

//Getting Handleshandle = desg.getHandles(report, Designer.IMAGE)[0];

//Changing the Property Value// change the image "coffee.gif" to "sky.gif"desg.set(handle, "PictureName", "sky.gif");

Quick Tour

34

Page 38: JReport Designer - Getting Started - Logi Analytics

// change the image positiondesg.set(handle, "X", 2.24f);

// change the image widthdesg.set(handle, "Width", 4.76f);desg.exit();

By creating a Designer instance in your Java program, you can modify an existing report or create a report (based on theexisting catalog and query) with the methods provided by Designer API.

JReport Engine Bean

import jet.bean.*;import java.awt.*;import java.awt.event.*;

Then, we will create an instance. To report with JREngine Bean, you should create an instance of JREngine Bean first.The constructor of JREngine Bean has no parameter. After the object is created, you should set the report home, reportfile, catalog file, result file (if necessary), parameter values (if necessary). After runReport(), call the export or printmethods for exporting report result file to multiple output.

bean = new JREngine();bean.setReportHome("c:\\jreport");bean.setReportName("c:\\jreport\\demo\\reports\\phaseorder.cls");bean.setCatName("c:\\jreport\\demo\\reports\\Tutorial.cat");bean.setParamValues("STARTDATE=1998−05−15,ENDDATE=1998−06−10");bean.setResultFile("c:\\jreport\\temp\\phaseorder.rst");bean.runReport();

bean.exportToHtml("c:\\test\\phaseorder.html");bean.exportToPdf("c:\\test\\phaseorder.pdf");bean.printReport();

JReport Result Viewer Bean

import jet.bean.*;import java.awt.*;import java.awt.event.*;import javax.swing.*;

Then, we will create an instance. To run with JRResultViewer Bean, you should create an instance of JRResultViewerBean first. The constructor of JRResultViewer Bean has no parameter. After the object is created, you should set thereport name, set temp path (if not set then the current path will be the default). After runReport(), call the export or printmethods for exporting report result file to multiple output. The important thing is that the report name here is the reportresult generated by JReport engine. In other words, the report result file is generated by JReport Designer, JReportEngine Bean or JReport Enterprise Server.

bean = new JRResultViewer();bean.setShowInfoLevel(bean.vDebug | bean.vError);bean.setReportName("c:\\jreport\\temp\\phaseorder.rst");bean.runReport("yes");

bean.exportPS("c:\\test\\phaseorder.ps");bean.exportToRtf("c:\\test\\phaseorder.rtf");bean.printReport();

Quick Tour

35

Page 39: JReport Designer - Getting Started - Logi Analytics

Delivering Reports

Export Report Result to HTML

JReport can export a report to various formats: JReport Result, Text, HTML, PDF, Postscript File, Mail, Applet, Excel Fileand Fax. To export the report, use menu File | Export. Below is an example for exporting a report to HTML.

First, select File | Export | To HTML to get the Web Wizard dialog.

Report TabGive the HTML file name and decide whether you would like to export to a Multiple or Single file. You can alsochoose the browser and Table Format etc.

Directory TabSpecify the directory in which to place the exported HTML files.

ChartApplet TabChoose to display charts.

Note TabSome necessary information on HTML.

View the result as below.

Quick Tour

36

Page 40: JReport Designer - Getting Started - Logi Analytics

Note: We selected Multifile in this example, so JReport designates a serial number for each HTML page. This means ifyou have a 3−page report named "Invoice", JReport will create three files called Invoice_1.html, Invoice_2.html andInvoice_3.html. You can go to the next or previous page by clicking the Next or Previous Button.

Deploying a Report

JReport Designer, including all the shipped components (such as JReport Designer API, JReport Engine Bean, JReportResult Viewer Bean), is the client side report development environment. Pre−developed reports can also be deployed toother places or JReport Enterprise Server for running in the client/server environment.

Remote Access of JReport Enterprise Server

Using Browser

First, you need to load a Web Browser (here we use IE), then input the home page of the server in the address bar.

Quick Tour

37

Page 41: JReport Designer - Getting Started - Logi Analytics

After login, you can view the directories in the server, and select the directory containing the catalog and the specificreport you would like to view.

Quick Tour

38

Page 42: JReport Designer - Getting Started - Logi Analytics

For example, we choose tutorial.cat which is under \AccessDemo.

Quick Tour

39

Page 43: JReport Designer - Getting Started - Logi Analytics

Select one report. Click Advanced Run in the Control column.

Quick Tour

40

Page 44: JReport Designer - Getting Started - Logi Analytics

After selecting the output format, click the submit button. Then you can get the following report result.

Quick Tour

41

Page 45: JReport Designer - Getting Started - Logi Analytics

Client Viewer Bean

To use client viewer bean, the first thing you need to do is to download the JREntVBean.zip file from Jinfonet web site.The file JREntVBean.zip should be used when compiling and running your application program which calls JReportViewer Bean. Inside the JREntVBean.zip file, you will find a document named ViewerBeanUsage.htm which introducesthe files in JREntVBean.zip.

There are three methods to invoke JReport Viewer Bean, depending on how much control your application requires:

One Step ViewerIn this method, your Java applications will call the JReport bean named JRDirectViewer and provide the followingproperties:

setServerName ("theServerName");setPort ("thePortNumber");setReportName ("theReportName");setCatName ("theCatalogName");setLoadReport ("Yes/No");

After the JRDirectViewer bean has been loaded, it will ask JReport Enterprise Server to run the report and pop

Quick Tour

42

Page 46: JReport Designer - Getting Started - Logi Analytics

up a dialog on the screen to ask you to input the report parameters (if needed).Two Step ViewerIn this method, your Java application first calls a JReport bean named JRPrepareViewer to prepare theparameters with the following properties:

setServerName ("theSevrerName")setPort ("thePortNumber")setReportName ("theReportName")setCatName ("theCatalogName")setLoadReport ("Yes/No")

After the parameters have been prepared, the second JReport bean named JRRunViewer will be called toprovide the parameter with the following properties:

setServerName ("theServerName")setPort ("thePortNumber")setReportName ("theReportName")setCatName ("theCatalogName")setLoadReport ("Yes/No")setParameters ("Parameters")

Second Step ViewerThis method is identical to the second step of the Two Step method. Your application has already knows theparameters (the parameters are prepared), then call JReport bean named JRRunViewer directly in one step withthe required properties:

setServerName ("theSevrerName")setPort ("thePortNumber")setReportName ("theReportName")setCatName ("theCatalogName")setLoadReport ("Yes/No")setParameters ("Parameters")

Demo Reports

JReport provides you with some typical demo reports which are available under %installroot%demo\reports\tutorial.cat.Below is a listing and brief introduction for the demo reports.

3DArrayBarChart.clsDemonstrates a chart type: 3D bar with table.

3DPieChart.clsDemonstrates a chart type: 3D pie with table.

BarChart.clsDemonstrates a chart type: 3D bar.

BarLineChart.clsDemonstrates a chart type: Combo (Bar_Line) with table.

Bubble.clsDemonstrates a chart type: Bubble with table.

ConditionalControlByFormula.clsDemonstrates conditional control by a formula.

Crosstab.clsA report about the sales of each region. It shows the usage of Cross−tab.

CustomersAddress.clsLists customer address information with text object.

DateParameterUsage.clsReports the customer order information. Parameters are used to list data only for some specified days.

Quick Tour

43

Page 47: JReport Designer - Getting Started - Logi Analytics

DynamicQuery.clsShows the usage of dynamic query.

ExistingQueryUsage.clsA report about product information created by a query file.

FormLetter.clsAn example for a form letter that helps you to create a pre−defined letter more easily.

FormulaUsage.clsCreated with multiple tables shows the usage of formula and summary.

GroupByDate.clsA report which reports the order information per week and per month. It demonstrates the usage of group by afield related to date.

GroupingWithFormulas.clsLists the customer information by alphabetical order. It demonstrates how to group with a formula.

ImageUsage.clsA demo report of an order list which demonstrates how to use objects of image, drawing etc. and how to setproperty value such as color.

Invoice.clsA demo report of a typical invoice.

LineChart.clsDemonstrate a chart type: 3D line.

ListByCategory.clsDemonstrates how to use sub−report create a complex report. Four sub−reports are used in this report:SbyRegion−Sub1.cls, SbyRegion−Sub2.cls, Crosstab.cls and BarChart.cls.

OrderForm.clsA demo report of a typical order form.

PageHeaderSuppression.clsDemonstrates how to suppress a certain section on the first page.

ParameterUsage.clsReports the customer order information. A parameter is used to list data only for some specified regions.

Radar.clsDemonstrates a chart type: Radar, with table.

RunningTotalFormula.clsA report of annual sales which calculates the annual sales for each page. This is a typical report of using runningtotal.

SbyRegion−Sub1.clsA sub−report of the report ListByCategory.cls.

SbyRegion−Sub2.clsA sub−report of the report ListByCategory.cls.

SortByColumn.clsA sub−report for SubreportOfMainReport.cls

SQLUsage.clsA demo report created from a SQL file.

StockChart.clsDemonstrates a chart type: Stock.

SubreportOfMainReport.clsA report with sub−report object which lists all the employees whose salaries are lower than the group averagesalary.

SummaryData.clsA chart and graph demo report which creates graphical views of summarized data.

SummaryDataCrosstab.clsA cross tab demo report which summarizes data and presents the summaries in a compact row and columnformat.

TableFormatting.clsShows how to set the color with formula.

TableReport.clsTable report that uses style groups.

Quick Tour

44

Page 48: JReport Designer - Getting Started - Logi Analytics

TableWithGrouping.clsA report about customer sales created with a single table.

TextObjectEmbedded.clsA demo report of letters which shows how to use a text object.

Quick Tour

45