Skip to main content



      Home
Home » Archived » BIRT » Here is a nasty hack to get around the Major bug in birt dates.
Here is a nasty hack to get around the Major bug in birt dates. [message #140690] Tue, 07 March 2006 09:15 Go to next message
Eclipse UserFriend
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 #140748 is a reply to message #140690] Tue, 07 March 2006 10:00 Go to previous messageGo to next message
Eclipse UserFriend
Hello birt,

nice idea, but still affected with problems:

I use a mySQl database server so I modified your query from to_char(...)
into DATE_FORMAT(...).
I have an easy query:

select DATE_FORMAT('2006-03-07', '%d.%m%.%Y') as MyDate;

which shows correctly under dataset-->Preview:

07.03.2006.

But if I drag/drop the MyDate field from data-explorer to the chart area
(see attachment birt1.jpg)
and run this report I get TWO lines back instead of ONE.
(see attachment birt2.jpg).

Under preview and HTML view out of eclipse environment and after deploying
it to e.g. JBoss, this error happens!
PDF output works fine.

Any idea whats wrong?



  • Attachment: birt2.jpg
    (Size: 29.77KB, Downloaded 144 times)
  • Attachment: birt1.jpg
    (Size: 32.78KB, Downloaded 147 times)
Re: Here is a nasty hack to get around the Major bug in birt dates. [message #140777 is a reply to message #140748] Tue, 07 March 2006 10:05 Go to previous messageGo to next message
Eclipse UserFriend
Sorry the 2nd one comes from the masterpage, which is preset to use a date
on the footer of the page!

;-)
Re: Here is a nasty hack to get around the Major bug in birt dates. [message #140990 is a reply to message #140690] Tue, 07 March 2006 13:05 Go to previous messageGo to next message
Eclipse UserFriend
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.
>
>
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 Go to previous message
Eclipse UserFriend
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.
>>
>>
>
>
Previous Topic:Interactivity: Mouseover AND mouseclick?
Next Topic:Report Mechanics
Goto Forum:
  


Current Time: Wed May 28 15:36:48 EDT 2025

Powered by FUDForum. Page generated in 0.03372 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top