explorer Posted February 13, 2012 Share Posted February 13, 2012 Hi All,I wish to display page footers only wher there is more than one page in the report. To achieve this, I have specified the expression: new Boolean($V{PAGE_NUMBER}.intValue() > 1)in the "Print When Expression" property of the Page Footer band. However, this expression doesn't do the required task as the page footer is displayed even when there is a single page in the report.I understand that for it work, the expression evaluation time should be "Report" instead of "Now". However, there is no way available (atleast in iReport) to specify the time for band's condition's evaluation. So, given this constraint, how can I achieve my above-stated goal.Thank you. Code:<pageFooter> <band height="15"> <printWhenExpression><![CDATA[new Boolean($V{PAGE_COUNT}.intValue() > 1)]]></printWhenExpression> <textField> <reportElement x="248" y="1" width="80" height="14"/> <textElement textAlignment="Right"/> <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression> </textField> <textField evaluationTime="Report"> <reportElement x="327" y="1" width="29" height="14"/> <textElement/> <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression> </textField> <textField evaluationTime="Report"> <reportElement x="128" y="0" width="100" height="15"/> <textElement textAlignment="Center" markup="none"/> <textFieldExpression><![CDATA["Continued..."]]></textFieldExpression> </textField> </band> </pageFooter> Link to comment Share on other sites More sharing options...
mennei Posted February 13, 2012 Share Posted February 13, 2012 Hi,Do you try to debug the print expression? The rule is that if the expression return FALSE the band will hide. Also, If I was in your postion, I would delete the last page footer band (if it exist) to unsure that it will not appears.To debug the expression just add text field with this expersstion some where in your report template.Good luck. Link to comment Share on other sites More sharing options...
explorer Posted February 14, 2012 Author Share Posted February 14, 2012 Thanks for your reply.On re-checking the code, I found that I was actually using the variable PAGE_COUNT instead of PAGE_NUMBER in the condition, and hence the footer was displaying even when there was a single page in the report. The main problem however remains unresolved. On using the expression, new Boolean($V{PAGE_NUMBER}.intValue() > 1) , the footer on the first page is not displayed. This is probably due to the variable PAGE_NUMBER being evaluated "now" rather that at the end of the report. How can I get this expression to be evaluated at the end of the report so that the footer on each page is displayed only when the report is two or more pages long?Thank you. Link to comment Share on other sites More sharing options...
mennei Posted February 14, 2012 Share Posted February 14, 2012 I notice that in text field you have the evaluation time property as the print when experssion property.So, I'll try to put the "page n from m" expression in text field and in the text field properties do the logic, not in the band, so in page one case the band will be display empty because the text field's printWhen experssion, and in more than one pages case the text field will appear. Link to comment Share on other sites More sharing options...
explorer Posted February 14, 2012 Author Share Posted February 14, 2012 Thanks again for replying back. In my humble opinion, specifying Print When Expression condition with the textfields will cause the page footer band to occupy space on the page report even when the expression evaluates to false and text fields don't display any text. I am sorry as I didn't state it earlier, but my goal is also to not waste report page space in accomodating a band when it is not displaying any data/text. Link to comment Share on other sites More sharing options...
mennei Posted February 14, 2012 Share Posted February 14, 2012 try to check the "Remove line when blank" attribute.From the ireport guide "This option takes away the vertical space occupied by an object, if it is not visible;the element visibility is determined by the value of the expression contained in thePrint when expression attribute or in case of text fields by the Blank when nullattribute too. Think of the page as a grid where the elements are placed, with a linebeing the space the element occupies. Figure 5-12 highlights the element A line; inorder to really remove this line, all the elements that share a portion of the linehave to be null (that is, they will not be printed)" Link to comment Share on other sites More sharing options...
explorer Posted February 14, 2012 Author Share Posted February 14, 2012 I am already using the "Remove Line When Blank" property with other fields in the Summary band of the report and it is not working. See my post related to this issue in this forum here.I appreciate your attempts to help me find a solution to this issue. /tools/fckeditor/editor/images/smiley/msn/thumbs_up.gif Link to comment Share on other sites More sharing options...
mennei Posted February 14, 2012 Share Posted February 14, 2012 Do you try to warpped the text fileds with a frame? The frame have those attributes as well... Link to comment Share on other sites More sharing options...
explorer Posted February 14, 2012 Author Share Posted February 14, 2012 I was not using the frame component to enclose the text fields. After reading your reply, I gave this idea a try, and enclosed the text fields in the frame component and specified the same print evaluation condition as defined for the text fields, but it didn't work; still a blank line is displayed.Common, things should not be so difficult. If a feature is given then it ought to work as the Japser Report version being used - version 4.5 - is a final relase version, and not some alpha/beta version. Link to comment Share on other sites More sharing options...
mennei Posted February 19, 2012 Share Posted February 19, 2012 Hi!The much I got is to show the page footer in the first page while in the other is ignore. I try those ideas: 1) use varibale that initialze with the $V{PAGE_NUMBER}. 2) debug the condition that apply in the "printWhenExspression" to apply as need.Let me know, please if you solve this issue as well.Good luck. Link to comment Share on other sites More sharing options...
explorer Posted February 20, 2012 Author Share Posted February 20, 2012 Thanks for your continued attempts to help me!I am also able to show page footer on the first page, and ignore it in the rest of the pages. This is however not what I am trying to achieve. I want to accomplish two goals:1) Display the expression "Page currentPage of totalPages" in the footer of each page only when the report is two or more pages long.2) If the report is only one page long, then don't display the footer. Also don't let the footer band occupy any space on the report page.I have however given up as I am not able to achieve any of the above two goals. Link to comment Share on other sites More sharing options...
mennei Posted February 21, 2012 Share Posted February 21, 2012 Hi,Number 2 - I think it possibale. I get a report with one page but without the footer. the problem is that when the report have more than one page the first page is without footer. If this is close to the main goal it will be good for you. Link to comment Share on other sites More sharing options...
renepastor Posted May 21, 2013 Share Posted May 21, 2013 BuenasTengo el mismo problemaal parecer ireport no evalua los datos cuando el tipo de evaluacion no es "evaluation time = NEW" y por lo tanto las propiedades de remove liene no funciona para esta opcion yo estoy con la vercion 5.1 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