Custom ODA Driver ResultSetMetaData
Hi,<br />
<br />
I am hoping this is the correct forum for this query. I cannot see any ODA on these forums.<br />
<br />
We have created an ODA Driver based on the CSV and Hibernate examples in the Integrating and Extending BIRT Second Edition. Everything is working fine at present. We are using Eclipse SDK Indigo.<br />
<br />
However I want to be able to return a string or number in my ResultSet and apply a format if it is a number. For example, I have the following underlying data:<br />
<br />
<span style='font-family: Courier New'><br />
Row Column 1 Column 2<br />
1 100.123 200.232<br />
2 1000.789 100000.12345<br />
3 Missing 5.3452<br />
4 Missing Missing</span><br />
<br />
In the above example, I want to apply the number format of ###,##0.000 to Column 1 and 2. Missing is stored as a string so no format would be applied. The desired output in the report would be:<br />
<br />
<span style='font-family: Courier New'><br />
Row Column 1 Column 2<br />
1 100.123 200.232<br />
2 1,000.789 100,000.123<br />
3 Missing 5.345<br />
4 Missing Missing</span><br />
<br />
<br />
Scenario - Designing the Report<br />
<br />
When I create a new DataSet in the BIRT designer, it retrieves all of my column names correctly. However, I return JAVA_OBJECT from getColumnType. <br />
<br />
In the BIRT designer Output Columns dialog for the data set, the column types are all listed as String. When you click on Edit, the available types are:<br />
<br />
String, Decimal, Integer, Boolean, Date, Date Time, Float, and Time.<br />
<br />
In the report designer I have a Table with the data set columns assigned. You can right-click on the data set column and select Change Data Column... item. This shows the Select Data Binding dialog. In this dialog, you can select the column and click on Edit... button. This shows the Edit Data Binding dialog. In the Data Type dropdown, you can change the type to be one of the following:<br />
<br />
Blob, Boolean, Date, Date Time, Decimal, Float, Integer, Java Object, String, and Time<br />
<br />
Our system has a concept of Missing values. I am handling this in the ODA Driver Query class which will have a string value of Missing. Valid values will be of type Double.<br />
<br />
Issue<br />
<br />
My issue is I want to return a string or a double from the column. If it is a number then I want to be able to customise the number format of the column in the designer. ResultSet#getString(int) is always being called to retrieve the value for the report.<br />
<br />
I was hoping that I could use the getColumnType to return JAVA_OBJECT would do this.<br />
<br />
Any help/pointers greatly appreciated.<br />
<br />
Andez