Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 14:15 Go to next message
Simon Hobbs is currently offline Simon HobbsFriend
Messages: 40
Registered: July 2009
Member
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 15:00 Go to previous messageGo to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
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 136 times)
  • Attachment: birt1.jpg
    (Size: 32.78KB, Downloaded 141 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 15:05 Go to previous messageGo to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
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 18:05 Go to previous messageGo to next message
Melissa Crist is currently offline Melissa CristFriend
Messages: 24
Registered: July 2009
Junior Member
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 20:53 Go to previous message
Simon Hobbs is currently offline Simon HobbsFriend
Messages: 40
Registered: July 2009
Member
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: Mon Dec 30 16:22:49 GMT 2024

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

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

Back to the top