| By Jason Weathersby, Tom Bondur, Jane Tatchell | Article Rating: |
|
| April 30, 2007 07:45 AM EDT | Reads: |
49,259 |
Changing the Data Set Binding of a Report Item
You
can also use the report item's setDataSet( ) method to set or change
the data set used by a report item. If you change the data set used by
a report item, you must ensure that the contents of the report item
access only data bindings that are supplied by the new data set. If
necessary, you must change the references to data bindings in data
elements, text elements, and scripting methods. If the data bindings in
the old data set don't match the names or data types of the fields that
the new data set provides, you must correct the data bindings before
you generate a report from the modified report design. Use the
ReportItemHandle method, columnBindingsIterator( ) to iterate over the
column bindings that the report item uses. The items in the list are
ComputedColumnHandle types. This class provides methods to access the
name, expression, and data type of the column binding.
To access the data set column and expression that a data item uses, call the methods, getResultSetColumn( ) and getResultSetExpression( ). You can compare the data type and name with the result set columns that the data set returns.
How To Bind a Data Set to a Table
The code sample in Listing 8
shows you how to check for a particular data set in a report design
then changes the data set for a table. The code finds the table and
data set by name. Alternatively use slot handles to navigate the report
design structure. The variable, design, is a ReportDesignHandle object.
Saving a Report Design Programmatically
After
making changes to an existing report design or creating a new report
design, you can choose to save the design for purposes of archiving or
future use. To overwrite an existing report design to which the
application has made changes, use the ReportDesignHandle save( )
method. To save a new report design or to keep the original report
design after making changes, use the ReportDesignHandlesaveAs( ) method.
Alternatively, if you don't need to save the changes to the report design, use the ReportDesignHandleserialize( ) method. This method returns an output stream. The report engine can generate a report by opening a stream as an input stream.
If you don't need to make any further changes to the report design, use the ReportDesignHandleclose( ) method to close the report design.
How To Save a Report Design
The code below saves the open report design. The variable, design, is a ReportDesignHandle object:
design.saveAs( "sample.rptdesign" );
design.close( );
Creating a Report Design Programmatically
You can
build a report design and generate the report output in an application
without using BIRT Report Designer. You use the createDesign( ) method
on the session handle class, SessionHandle, to create a report design.
You use the other model classes to create its contents.
How To Create a New Report Design
The following code creates a report design:
SessionHandle session = DesignEngine.newSession( null );
ReportDesignHandle design = session.createDesign( );
ABOUT THE BOOK
This article is an excerpt from the
book Integrating and Extending BIRT by Jason Weathersby, Don French,
Tom Bondur, Jane Tatchell, and Iana Chatalbasheva and published by
Addison-Wesley. The book is the second volume in a two-book series
about business intelligence and reporting technology. The book
introduces programmers to BIRT architecture and the reporting
framework. It shows programmers how to build and deploy customized
reports using scripting and BIRT APIs. It also describes how to use key
extension points to create a customized report item, a rendering
extension for generating output other than HTML or PDF, and an Open
Data Access (ODA) driver for a new data source. (See Book)
Published April 30, 2007 Reads 49,259
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Jason Weathersby
Jason Weathersby is a member of the extended BIRT development team at Actuate Corporation and has backgrounds in both computer science and technical writing. He has many years experience in technical consulting, training, writing, and publishing about reporting, business intelligence tools, and database technologies.
More Stories By Tom Bondur
Tom Bondur is a member of the extended BIRT development team at Actuate Corporation and has backgrounds in both computer science and technical writing. He has many years experience in technical consulting, training, writing, and publishing about reporting, business intelligence tools, and database technologies.
More Stories By Jane Tatchell
Jane Tatchell is a content development manager in the Developer Communications group of Actuate Engineering.
- IBM Puts Systems Chief on Leave of Absence
- Amazon Web Services Database in the Cloud
- SpringSource Moving to Spring 3.0
- Virtualization Expo Call for Papers Deadline December 15
- Move Over BI, Here Comes PI - Performance Intelligence
- Using Ext JS, Servlets, JSON, MySQL and Tomcat on Fedora
- Qt DevDays 2009 - Munich
- Developing APIs for the Cloud
- Canonical Offers Free Cloudware
- New-Generation Virtualization Technologies with Ultra Low-Cost Endpoints
- The Planet Executive to Speak at Cloud Computing Conference
- Trusting the Cloud
- Oracle-Sun: IBM Reportedly Behind Delay
- The Case for Single-Purpose Services
- IBM Puts Systems Chief on Leave of Absence
- Cloud BI & Amazon VPC
- Cloud-Oriented Switch Start-up Valued at $230M
- The Curious Case of Build Release Management eBook
- Amazon Web Services Database in the Cloud
- Tips for Efficient PaaS Application Design
- Reporting Solutions Using Crystal Reports for Eclipse
- SpringSource Moving to Spring 3.0
- Virtualization Expo Call for Papers Deadline December 15
- Un-Clouding Federal Security Compliance
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- Creating Web Applications with the Eclipse Web Tools Project
- Eclipse Special: Remote Debugging Tomcat & JBoss Apps with Eclipse
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- How to Bring Eclipse 3.1, J2SE 5.0, and Tomcat 5.0 Together
- SYS-CON Webcast: Eclipse IDE for Students, Useful Eclipse Tips & Tricks
- Eclipse: The Story of Web Tools Platform 0.7
- "Eclipse 3.0 is a Great Leap Forward," Says JDJ's Dudney
- Developing an Eclipse BIRT Report Item Extension
- The Top 250 Players in the Cloud Computing Ecosystem





























