Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting Oracle Reports (.rdf) to BIRT reports

I have some Oracle Reports (.rdf) that I am considering converting to BIRT reports. Is there a way to convert .rdf files to BIRT report design files?

like image 716
shikarishambu Avatar asked Jan 14 '11 20:01

shikarishambu


3 Answers

A fully automated solution is probably not possible. You can partially automate the conversion process as follows:

  1. Convert the RDF files to XML.
  2. Extract the report query.
  3. Convert the XML to BIRT (or JRXML) using XSLT.

XML Conversion

The first step is fairly simple, using Cygwin:

cd /path/to/reports/
mkdir xml
for i in *.rdf; do
  rwconverter.exe batch=yes source="$i" dest=xml/"$i".xml dtype=xmlfile \
    userid=scott/tiger@xe
done

Extraction

The second step is also relatively easy, using starlet (rename xml.exe to starlet.exe to avoid conflicts with Oracle's xml.exe):

starlet.exe sel -t -v "/report/data/dataSource/select" filename.rdf.xml

You can also use xmllint, but it includes the select and CDATA elements, which you'd have to parse separately:

xmllint --xpath /report/data/dataSource/select filename.rdf.xml

Format Conversion

The third step is challenging. Create an XSL template that reads the RDF layouts (e.g., <displayInfo x="0.74377" y="0.97913" width="1.29626" height="1.62695" />). Then convert those layouts to the corresponding format used by the destination report engine (such as BIRT or JasperReports).

You wouldn't get a 100% solution, but an 80% solution could significantly reduce the amount of monotonous, error-prone work required to convert the reports.

like image 160
Dave Jarvis Avatar answered Sep 28 '22 08:09

Dave Jarvis


I once had a job to convert *.rdf files to Jasper reports. Since I don't know BIRT, I have no idea if this approach would work with BIRT, too.

Anyway, I exported the *.rdf files as xml and parsed the output with Perl and wrote the Jasper definitions, also as xml. For most reports, this worked pretty well. I have -however- one report in mind that I couldn't translate automatically: that was a report where the result set of two queries were laid out side by side.

like image 43
René Nyffenegger Avatar answered Sep 28 '22 09:09

René Nyffenegger


I haven't found any tools which do this. Some might call this a business opportunity.

RDF files, as far as I can tell, are in some funky binary format. To even have a shot at this, I'd probably convert it first into a REX file, which is supposed to be portable xml. Then, it is a matter of transforming from the REX structure to the BIRT structure. Honestly, I have no idea how documented the REX file is, but maybe since you know how it looks from the visual side you can make sense of it.

Good luck!

like image 40
Adam Hawkes Avatar answered Sep 28 '22 09:09

Adam Hawkes