How to convert string to integer in BIRT after fetching it from the database?

烂漫一生 提交于 2019-12-23 03:22:34

问题


I use BIRT for reports and i am a beginner BIRT user. In my report i must calculate the average of a column. (database is an oracle)

In my open script I have sth. like this:

sqlText = "select A, B, C, D, ((date1-date2) day to second) as differencedate from problem";

difference date column values are like this: 0 0:22:15 and in my fetch I have

if (!maximoDataSet.fetch())
    return (false);

row["A"] = maximoDataSet.getString("A");
row["B"] = maximoDataSet.getDate("B");
....    

row["differencedate"]=maximoDataSet.getString("differencedate");

return (true);

I tried to split the string and get the seconds from the differencedate and convert it to integer using plain JavaScript but I am getting an error like "split null" etc. So my question is how can i convert this column to integer in BIRT?


回答1:


Try retrieving the date difference from the database as a number - like so:

select A, B, C, D, 
       ((date1-date2) day to second) as differencedate,
       (date1-date2) * 86400 as differenceseconds
from problem


来源:https://stackoverflow.com/questions/12971579/how-to-convert-string-to-integer-in-birt-after-fetching-it-from-the-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!