Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
DateTime as parameter to DataSource
Hakan
Hi!
I have several reports that all take at least two parameters startDate and endDate.
These parameters are bound to parameters in the data source.
This works well.
But the funny thing is that when I trace what parameter values are actually sent to the database I get date on this format for all reports but one: '2012-01-13 00:00:00'
Then there is one report that is different.
When running this report in the designer preview mode it sends the date time parameter value to the database in this format: 'Nov 17, 2011 12:00 AM' !! Very strange, but still kind of okey since SQL Server still understands this.
But when I deploy this report and access it via tomcat and the viewer the format of the data time parameter now becomes '13 jan 2012 00.00' ... this is not okey since SQL Server does not know how to parse this date time string.
What could cause this ? All ideas are welcome !
Thanks,
H?kan
Find more posts tagged with
Comments
Hans_vd
Hi H?kan,
A date is only given a format when you convert it to a string.
So my guess is that somewhere this date is written in a string format. Can you confirm that your report parameter as well as your dataset parameter have the Date Time data type? And that there are no expressions of any kind on these parameters that convert it to a String?
Regards
Hans
Hakan
Hi Hans,<br />
<br />
Thanks for your response. <br />
What you say is very reasonable, but I think I have double check this many times now.<br />
<br />
Where could it actually be wrong ?<br />
1. in report parameter configuration<br />
2. in data binding configuration<br />
3. in data set parameter configuration<br />
<br />
+ potentially in a script or event handler. <br />
I do have a java event handler that manipulates the sql query before it is sent to the database, but this event handler does not affect this part (especially since the parameter value is represented as a "?" in the dynamic sql).<br />
<br />
Is there something more that could affect this ?<br />
<br />
Please see attached pdf for pictures of this configuration.<br />
<br />
Thanks,<br />
H?kan<br />
<br />
<blockquote class='ipsBlockquote' data-author="'Hans_vd'" data-cid="94028" data-time="1326440727" data-date="13 January 2012 - 12:45 AM"><p>
Hi H?kan,<br />
<br />
A date is only given a format when you convert it to a string.<br />
So my guess is that somewhere this date is written in a string format. Can you confirm that your report parameter as well as your dataset parameter have the Date Time data type? And that there are no expressions of any kind on these parameters that convert it to a String?<br />
<br />
Regards<br />
Hans<br /></p></blockquote>
Hans_vd
H?kan,
So you have two date parameters in the report. Are both giving you unexpected results or is 1 parameter value doing good while the other one is not?
Regards
Hans
Hakan
Hans,<br />
I get the same unexpected date format for both parameters.<br />
<br />
I have now downloaded birt source code for the version of birt that we are using (2.6.2), not so easy to figure this out, but it seems like birt converts the date to a string before the parameter value is sent to the jdbc driver i.e. the problem must be in birt. But what controls this I have not been able to figure out.<br />
<br />
Thanks,<br />
H?kan<br />
<br />
<blockquote class='ipsBlockquote' data-author="'Hans_vd'" data-cid="94121" data-time="1326485771" data-date="13 January 2012 - 01:16 PM"><p>
H?kan,<br />
<br />
So you have two date parameters in the report. Are both giving you unexpected results or is 1 parameter value doing good while the other one is not?<br />
<br />
Regards<br />
Hans<br /></p></blockquote>