Here is a nasty hack to get around the Major bug in birt dates. [message #140690] |
Tue, 07 March 2006 09:15  |
Eclipse User |
|
|
|
You cant do something like this:
Query:
Select sysdate as mydate from dual
And in your report data time:
Row["mydate"]
What you will get is something like this:
7 March 2006 00:00
Instead of
7 March 2006 15:32
No matter what you set the date output format to be, the time is always zero
or the formatted equivalent of it.
In the data set output columns, Birt understands that mydate is a date
column. You cannot change the type manually.
Having exhausted all possible solutions of getting the time using the date
type, I switched to returning strings instead of dates from oracle.
For example:
Select to_char(sysdate, 'DD/MM/YYYY HH24:MI:SS') as mydate from dual
Now you can format the output data item how you like (using the sql to_char
function) and the time will be shown, e.g:
07/03/2006 15:32:23
Note: Birt now thinks this is a string column. I could find no way to get
the seconds out with birt thinking it a date column.
|
|
|
|
|
|
Re: Here is a nasty hack to get around the Major bug in birt dates. [message #141081 is a reply to message #140990] |
Tue, 07 March 2006 15:53  |
Eclipse User |
|
|
|
The issue is that when selecting a datetime object form the database, birt
truncates the time part, so the time is always 00:00.
Therefore to display a date correcty, the only way seems to ignore the birt
date object and use the database to format the date/time, instead of birt.
Yes, I am aware that there is a date as part of the master page, but I am
not trying to return the current date, rather the datetime that a
transaction was made, e.g:
select id, written as "transaction done at" from transactions where id =
1234
Should show:
ID Transaction done at
1234 21/12/06 12:22:33
However, getting the abve using birt date object of a data row is
impossible, it would show:
ID Transaction done at
1234 21/12/06 00:00:00
Anyway, all the birt built in DateTimeSpan functions for manipulating hours,
minutes and seconds are fairly pointless, as it looses hours/minutes/seconds
when it pulls the data out of the database.
Actually, what I am forced to do is something like:
select
id,
written as transdateonly
to_char(written, 'DD/MM/YYYY HH24:MI:SS' ) as
transdateandtimeasstring
from
transactions
where
id = 1234
Then at least I can manipluate the date part as a date object, but if I want
to manipulate the time part, e.g. to compare the trans time with another
time, I will have to build up a date from the time string parts.
What a waste of time!
Birt.
"Melissa Crist" <melcri@comcast.net> wrote in message
news:duki1p$n4n$1@eclipse.org...
> Is BIRT aware of this issue? Because the TO_CHAR function just adds
> unecessary overhead to the query.
>
> "birt" <birt@ohds.co.uk> wrote in message news:duk4hn$otf$1@eclipse.org...
>> You cant do something like this:
>> Query:
>>
>> Select sysdate as mydate from dual
>>
>>
>>
>> And in your report data time:
>>
>> Row["mydate"]
>>
>>
>>
>> What you will get is something like this:
>>
>> 7 March 2006 00:00
>>
>> Instead of
>>
>> 7 March 2006 15:32
>>
>>
>>
>> No matter what you set the date output format to be, the time is always
>> zero or the formatted equivalent of it.
>>
>>
>>
>> In the data set output columns, Birt understands that mydate is a date
>> column. You cannot change the type manually.
>>
>>
>>
>> Having exhausted all possible solutions of getting the time using the
>> date type, I switched to returning strings instead of dates from oracle.
>>
>>
>>
>> For example:
>>
>>
>>
>> Select to_char(sysdate, 'DD/MM/YYYY HH24:MI:SS') as mydate from dual
>>
>>
>>
>> Now you can format the output data item how you like (using the sql
>> to_char function) and the time will be shown, e.g:
>>
>> 07/03/2006 15:32:23
>>
>>
>>
>> Note: Birt now thinks this is a string column. I could find no way to
>> get the seconds out with birt thinking it a date column.
>>
>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03372 seconds