Jump to content
We've recently updated our Privacy Statement, available here ×

nealhudson

Members
  • Posts

    33
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by nealhudson

  1. [deleted] Post edited by: nealhudson, at: 2007/09/20 15:38
  2. hmmm.. ok. So if straight java is not supported, is there any way in the expression box of doing what I want? (i.e. check to see if a string value contains a double, if it does then return it, if not then return 0).
  3. This code works fine through a java compiler, stumped as to why it won't in iReports: try{ return new java.lang.Double(java.lang.Double.parseDouble($F{Time})); } catch(NumberFormatException e){ return new java.lang.Double(0); }
  4. Hi I'd like to convert a string to a double. The issue is that sometimes the string does not contain numeric data. I was thinking of placing a try catch block in the value expression for a variable. Something like this: try{ new java.lang.Double(java.lang.Double.parseDouble($F{Time})); } catch(NumberFormatException e){ new java.lang.Double(0); } where $F{Time} is a string field returned from the database. However, I keep getting the following errors when trying to compile the report: Syntax error on token "(", ; expected Syntax error on token ")", delete this token
  5. Thanks Lucien, I tried searching and came across this post: http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=view&catid=10&id=29495 It turns out that if I remove the Timezone setting from the datasource it works. It's good to find the source of the problem, but annoying that it took so long - I've wasted over a day on this - I'm new enough to Jasper and thought it must have been something to do with the way the report or parameters were set up, not the datasource!
  6. Hi there, I have a report which I have designed in iReports, over a MySQL database table containing an epoch time field. As part of the report, I have defined 2 java.util.Date parameters, to select a from and to date range. The SQL query contains the following where clause: WHERE l.time >= UNIX_TIMESTAMP($P{starttime})) AND l.time <= (UNIX_TIMESTAMP($P{endtime})) When I run this query in MySQL Query browser, it runs fine if I enter a date in the format '2006-09-05 21:50'. I have not entered any default values for the parameters, but selected the 'Use as a Prompt' option. In the JRXML file, the fields are defined as java.util.Date. When I run the report and select the dates, it pulls back records correctly. On Jasperserver, I’ve set up a datatype called 'datetime', which is of type Date/Time. I have then set up a report based on the JRXML for the report outlined above, with the 2 input controls for the date range, using the newly created 'datetime' datatype for each and making them mandatory. When I run the report in Jasperserver I am not getting any records back :( I've turned on DEBUG level logging in log4j, and have noticed the following message which I think is what the problem is: 29 Aug 2007 10:37:38,237 DEBUG net.sf.jasperreports.engine.query.JRJdbcQueryExecuter ,http-8080-3:206 - Parameter #2 (starttime of type java.lang.String): Mon Aug 14 11:37:00 BST 2006 29 Aug 2007 10:37:38,239 DEBUG net.sf.jasperreports.engine.query.JRJdbcQueryExecuter ,http-8080-3:206 - Parameter #3 (endtime of type java.lang.String): Mon Aug 20 11:37:00 BST 2007 My question is - why are these defined as java.lang.String here and not java.util.Date? Thanks for any help Neal
  7. I just tried the method using the System DSN and this worked
  8. I also having trouble with this. The farthest I've got is by using the jTDS driver technique described here: http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=&func=view&catid=9&id=309#309 and the connection string url: jdbc:jtds:sqlserver://localhost:1433/myDatabase;instance=SQLEXPRESS I then get the error: SQL problems: Unable to get information from SQL Server: localhost. jdbc:jtds:sqlserver://localhost:1433/myDatabase;instance=SQLEXPRESS
×
×
  • Create New...