archanwizardsqueen Posted October 28, 2015 Share Posted October 28, 2015 I want to show date in text field in jasper report. I've kept expression class of that text field as "java.util.Date" because while exporting that date in excel I want to retain "format cells-category as Date or Custom type" instead of General. So that user can change date format if he wants. I don't want to use "java.text.DateFormat" because of the same above given reason. But I want to pass my date format as parameter to report and use that in report.like pattern = "$P{myDateFormat}"myDateFormat can be anything dd-MMM-yyy, dd/MM/yy or just anything given in javaBut problem is, pattern property of textField does not take expression. I saw one bug closed for jasper which had same requirement see link. But don't know why it's not working.http://community.jaspersoft.com/ireport-designer/issues/932http://community.jaspersoft.com/jasperreports-library/issues/4905Also read of patternExpression but it's not present in ireport. Kindly tell me how to pass dynamic value to pattern. Link to comment Share on other sites More sharing options...
akonkin Posted October 29, 2015 Share Posted October 29, 2015 I think that the commnity wiki that I quote below would be helpful regarding your question:http://community.jaspersoft.com/wiki/how-use-built-msg-function-apply-custom-formatting-numeric-values one more article,http://community.jaspersoft.com/wiki/how-resource-bundlealternate-way-get-keyvalue Link to comment Share on other sites More sharing options...
akonkin Posted October 29, 2015 Share Posted October 29, 2015 I think that the commnity wiki that I quote below would be helpful regarding your question:http://community.jaspersoft.com/wiki/how-use-built-msg-function-apply-custom-formatting-numeric-values one more article,http://community.jaspersoft.com/wiki/how-resource-bundlealternate-way-get-keyvalue Link to comment Share on other sites More sharing options...
archanwizardsqueen Posted November 2, 2015 Author Share Posted November 2, 2015 I found the answer from jaspersoft support:-we can use patternExpression but it's not available in lower versions of iReport IDE so you need to compile and deploy jasper externally.<textFieldExpression class="java.util.Date"><![CDATA[$P{d8}]]></textFieldExpression><patternExpression><![CDATA[$P{userDateFormat}]]></patternExpression> 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