yogarajkhanal Posted July 22, 2009 Share Posted July 22, 2009 hi,in my report template i have static text field for the labels and correspoding name filed for the parameter that i will pass from my program.So my use case is like this First Name:YogarajMiddle Name:NullLast Name:Khanal I have to remove the static text field Middle Name when the value is null can you please tell me how do i achieve it?I saw something called print when expression in the properties of static text i am not sure if that will solve it ?can you please give me small example of print when expression if that solves it?Thanks,Yogaraj Link to comment Share on other sites More sharing options...
k1234 Posted July 23, 2009 Share Posted July 23, 2009 hi Yogaraj,I can give u one simple example,say there is a parameter called "OFFICE_ID", If u dont want to display one static text in your report when this "OFFICE_ID" parameter is null, Then do the following..1. In printWhenExpression give this expression new Boolean($P{OFFICE_ID}==null) and also Set RemoveLineWhenBlank is true. The Code should be like the following, <staticText> <reportElement x="196" y="0" width="100" height="20" isRemoveLineWhenBlank="true"> <printWhenExpression><![CDATA[new Boolean($P{OFFICE_ID}==null)]]> </printWhenExpression> </reportElement> <textElement/> <text><![CDATA[static text]]></text> </staticText> Please try out this. Thanks, Keerthi Link to comment Share on other sites More sharing options...
yogarajkhanal Posted July 27, 2009 Author Share Posted July 27, 2009 Hi Keerthi, I tried as below but didn't work.Anything I am doing wrong here? <staticText> <reportElement x="17" y="286" width="420" height="19" key="staticText-19" isRemoveLineWhenBlank="true"> <printWhenExpression><![CDATA[new Boolean($P{rtf}==null)]]></printWhenExpression> </reportElement> <box></box> <textElement> <font fontName="Times New Roman" pdfFontName="Helvetica-Bold" size="12" isBold="true"/> </textElement> <text><![CDATA[Refusal to File Reasons:]]></text> </staticText> Link to comment Share on other sites More sharing options...
yogarajkhanal Posted July 27, 2009 Author Share Posted July 27, 2009 new Boolean($P{rtf}!=null) solved my problem if any one have similar problem please contact me Link to comment Share on other sites More sharing options...
yogarajkhanal Posted July 27, 2009 Author Share Posted July 27, 2009 Keerthi, Do you know how do automatically shift the spaces up after i hide the static test by the field below it so that there is no gap in the page.Hope to hear back from you soon. Thanks, Yogaraj Link to comment Share on other sites More sharing options...
C-Box Posted July 27, 2009 Share Posted July 27, 2009 Have you ever spent some time in searching the forum before doing wild posts!?!??!?!? /tools/fckeditor/editor/images/smiley/msn/whatchutalkingabout_smile.gif Anyway:Take a look at the Attributes "RemoveLineWhenBlank " and also at "PositionType"set "RemoveLineWhenBlank" of your elements that should be removed to "true" and "PositionType" of every element that should move upwards to "float".There are also some samples provided with full JasperReports Download package that helps a lot.Just my two centsC-Box Link to comment Share on other sites More sharing options...
yogarajkhanal Posted July 27, 2009 Author Share Posted July 27, 2009 I am sorry I should have tried all options first.Its getting 5 and i wanted to wrap my work so tried getting feedback from user community.Anyway figured that out before you send me the suggestions.I was opening new thread with the hope that if new users find the similar problems they will have more references.I will read next time before I post.Thanks for your suggestion.Yogaraj 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