Jump to: navigation, search

BPS40

Revision as of 15:56, 30 March 2006 by Gxue (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

!!!ODA Data Source Binding to BIRT Report

(:table cellspacing='0' cellpadding='0' border='0' width='98%':) (:cell style='background-color: #e0e0e0; padding: 10px;':) This project aims to provide an easy way to bind ODA data source properties to report parameters and other runtime data.

!!Status Completed

!!History Proposed November 3, 2005

Implementation Complete Dec 20, 2005

!!Specification Lead Gary Xue

!!Expert Group Linda Chan, Wenbin He, Stanley Wang (:tableend:)

!Description An ODA Data Source defines a list of data source properties (“connection properties”) for which values must be furnished at runtime to establish a connection. In a common usage scenario, the values for these connection properties are not known at report design time. Rather their values are calculated at runtime based on user input or environment settings etc. In BIRT 1.x, runtime assignment of data source connection properties can be done only through scripting. There are two problems with this approach. Firstly it requires the report designer to write script code. Secondly the custom scripts are associated with the data source design. This makes it difficult to share the same data source design across multiple reports, since each report design may have its own logic for providing runtime values for these properties.

This project seeks to provide a solution for setting runtime values for ODA data source properties in a user-friendly and portable way. This is achieved by introducing the concept of Data Source Binding to BIRT report design. A report design may contain one or more Data Source Bindings. Each Data Source Binding is defined for one ODA data source referenced in the report. It binds one or more of the data source’s connection properties to respective Javascript expressions. At runtime, the BIRT engine resolves the values for each connection property before it opens a data source for the first time, in the following fashion:

  1. if a data source binding is defined in the report for that data source, and the binding associates the connection property with an expression, the expression is evaluated and its result used as the initial value for that property.
  2. Otherwise, the value of that property as defined in the data source design is used as the initial value.
  3. The beforeOpen script of the data source, if present, is evaluated, which can further modify the connection property value set in (1) or (2).

!!Example As an example, the out-of-the-box ODA-JDBC driver defines the following 4 static connection properties: odaDriverClass, odaURL, odaUser and odaPassword. Suppose the report would allow the user to specify the database, user and password for a JDBC data source when running the report. The report designer will define 3 named report parameters:

||border=1 width=50% ||!Parameter Name||!Data Type||!Description|| ||p_db ||String ||name of database to connect to || ||p_user ||String ||DB user name || ||p_password ||String||DB password ||


The report designer can then use report designer to define a Data Source Binding for the JDBC data source:

||border=1 width=70% ||!Connection Property||!Binding Expression|| ||odaURL ||"jdbc:my_driver:my_server;database=" + params["p_db"] || ||odaUser ||params["p_user"] || ||odaPassword ||params["p_password"] ||


Note that since no binding is created for property odaDriverClass, the value specified in the data source design for that property is used.

!!Capability List

  • Allow one or more of a data source’s connection properties to be bound to a Javascript expression. The binding expression can access report parameters.
  • Provide Model API to allow definition of and access to Data Source Bindings.
  • Provide UI for defining data source binding in BIRT Report Designer.

!!Specification Document(s) [| Functional Specification (Version 1 - Dec 21, 2005)]

!!Related Bugzilla Entries [| 109409]