| Summary: | [XML Data Source Improvements] Addition of XML Duration Data Type | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | malcolm davis <malcolmdavis> |
| Component: | BIRT | Assignee: | Mingxia Wu <mwu> |
| Status: | VERIFIED FIXED | QA Contact: | Tianli Zhang <tzhang> |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | bluesoldier, lchan, lzhu, malcolmdavis, xxue |
| Version: | 2.1.0 | Keywords: | plan |
| Target Milestone: | 2.5.0 M6 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | Autoed | ||
|
Description
malcolm davis
Hi there, I think you can use data type "string" to acquire the value of duration type, can you? If you want to do some specific operations for duration type, Because BIRT do not support duration type, we have to treat it as a string even if the duration type is supported. Thanks. Lin "String" can be used to acquire anything XML related. However: a. The String" form of an XML Duration type has no meaning on a report. Users do not understand P5Y2M10D. b. The "String" cannot be used to do any duration type calculations. Calculating pay, total hours worked, duration of a project, etc… c. In every IT and commercial and XML data source I have touched, there has been a XML Duration. I have seen Duration used at BellSouth, Fidelity Investments, Intuit, etc. From an XML data source perspective, Duration is not a minor thing. Some possible solutions: a. Time: BIRT has a Time data type. Using Time will depend on how the underlying Time type looks or can be used. b. IBM’s ICU Lib: BIRT is already uses and extends the ICU lib. There may be an option in ICU. c. Add a Duration type to BIRT. The Duration type would be beneficial to both XML and SQL worlds. d. Java 5: There is a XML Duration type in Java 5. [Drawback: If BIRT still needs to support JDK 1.4. e. JSR 310: Supposedly, JSR 310 (Date and Time API) will address the Duration issue. Yet, that is sometime in future. http://jcp.org/en/jsr/detail?id=310 http://wiki.java.net/bin/view/Projects/DateTimeScope http://wiki.java.net/bin/view/Projects/DateTimeDuration g. Other libs: There are open source libs like Joda that support the concept of duration. http://joda-time.sourceforge.net/key_duration.html Thanks, Malcolm We will need to add this data type to DTP/ODA in order for BIRT to be able to access it in external data sources. Transfer to DTP project for consideration. JRE (since 1.5) does have javax.xml.datatype.Duration to represent the Duration type. Before BIRT and DTP add native support for this data type, you can read the duration type as String, and then parse it using a custom Javascript function in BIRT. BIRT does provide a DataTimeSpan Javascript object that makes it easier to work with time span data. Once BIRT supports duration, one can parse a string retrieved from the oda.xml driver, using a custom Javascript function in BIRT and map to BIRT's duration type. Thus, adding support of duration data type in ODA interfaces should not be on the critical path here. Even with such support in ODA, one still won't be able to format such data in a meaningful way in a report item, nor do computation of such data unless a duration type is supported by BIRT. Having duration support in BIRT is the critical path and main enhancement, as described in comment #2. We will look into introducing the Duration type in BIRT, and offer Javascript functions to facilitate calculation based on Duration. We'll like to base this data type on javax.xml.datatypes.Duration (or correponding JSR 310 data type if that gets implemented soon enough). This will be done in the next major release. BIRT 2.2 must run on JRE 1.4, which does not have Duration support.
If your BIRT app is running on JRE 1.5 or later, you can in fact directly invoke the Java Duration class from Javascript expressions to help you perform conversion and duration calculations. Here is an example on how that can be done:
Suppose the XML data set has a column DURATION_COLUMN of type XML Duration. You will need to define and use that column as String in BIRT. You can however add that duration to a date/time column using Javascript expression like this:
duration = Packages.javax.xml.datatype.DatatypeFactory.
newInstance().newDuration(row["DURATION_COLOMN"]);
DateTimeSpan.addDate(row["DATE_COLUMN"],
duration.getYears(), duration.getMonths(), duration.getDays())
As per latest discussion we will only introduce a set of script function to manipulate duration-formatted data. Introduce BirtDuration function under BIRT Function's category. Here we support the mothod as following method: year( String lexicalDuration) month(String lexicalDuration) day(String lexicalDuration) hour(String lexicalDuration) minute(String lexicalDuration) second(String lexicalDuration) timeInMills(String lexicalDuration,DateTime startDate) isLongerThan(String lexicalDuration1,String lexicalDuration2) isShorterThan(String lexicalDuration1,String lexicalDuration2) Fix it now. BIRTDuration functions are added and worked as expected, issue #267570 has been found during the general testing and the further testing is in Progress, so mark this bug as verified first. Verified build: 2.5.0 v20090309-0630. |