topkatz Posted September 17, 2010 Share Posted September 17, 2010 I have a report that retrives a date object that can be 0000-00-00. I would like to continue to use the date field for this data in the report for formating reasons. Is there a way to handle this? Right now my report dies if my data contains 0000-00-00. Link to comment Share on other sites More sharing options...
darwin_chow Posted September 27, 2010 Share Posted September 27, 2010 I think you can use edit expression in date field. have you to try edit expression? Link to comment Share on other sites More sharing options...
Teodor Danciu Posted September 28, 2010 Share Posted September 28, 2010 Hi, You did not tell us what is the error and showed us the JRXML to understand what you are doing with this value. Thanks,Teodor Link to comment Share on other sites More sharing options...
topkatz Posted September 28, 2010 Author Share Posted September 28, 2010 I can not reproduce teh error right now as my tables are dumped, however I can show you the xml and tell you what is going on.Field deff:<field name="tbDate" class="java.sql.Date"> <fieldDescription><![CDATA[]]></fieldDescription> </field> Field display:<staticText> <reportElement x="159" y="298" width="41" height="14"/> <textElement/> <text><![CDATA[TBDate:]]></text> </staticText> <textField pattern="MM/dd/yyyy"> <reportElement x="200" y="298" width="63" height="14"/> <textElement/> <textFieldExpression class="java.util.Date"><![CDATA[$F{tbDate}]]></textFieldExpression> </textField> The problem is that this value is not always a real date, some times its '0000-00-00'. When it is, the report fails with an error saying that its not a date. I know I can work around this by setting the field as a string, but then I can not use the date pattern to alter the date format (which I want to do) Link to comment Share on other sites More sharing options...
faizal Posted January 19, 2011 Share Posted January 19, 2011 On my php file i put this: $conn = java('java.sql.DriverManager')->getConnection("jdbc:mysql://localhost:3306/database?user=$user&password=$password&zeroDateTimeBehavior=convertToNull"); I use tomcat + phpjavabridge + wamp, i just changed the connection string Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now