2004 IR Help Posted August 23, 2006 Share Posted August 23, 2006 By: Kirill Uvaev - kirill_uvaev Page N of M problem 2005-08-17 09:14 How can I hide <Page N of M> element if there is only one page in report? He problem in common way is that I cant find a way how to display variables (with varies from page to page) if some expression is true and contains this variable calulcated for the whole report. Do anybody have any ideas? By: Lucian Chirita - lucianc RE: Page N of M problem 2005-08-17 23:42 Hi If <Page N of M> lies on your page footer, you can do this: - copy your page footer into lastPageFooter - inside lastPageFooter, use Boolean.valueOf($V{PAGE_NUMBER}.intValue() != 1) as printWhenExpression for the text fields composing <Page N of M> HTH, Lucian By: Kirill Uvaev - kirill_uvaev RE: Page N of M problem 2005-08-18 02:37 Unfortunately report has such design, that page N of M is placed in background band. May be Tedor can give some directions? By: Lucian Chirita - lucianc RE: Page N of M problem 2005-08-18 03:23 Then if you have transparent textfields and you don't mind empty textfields you can try something like this <textField> <reportElement x="0" y="0" width="80" height="15"> <printWhenExpression>Boolean.valueOf($V{PAGE_NUMBER}.intValue() != 1)</printWhenExpression> </reportElement> <textElement textAlignment="Right"/> <textFieldExpression class="java.lang.String"> "Page " + String.valueOf($V{PAGE_NUMBER}) + " of" </textFieldExpression> </textField> <textField evaluationTime="Report"> <reportElement x="0" y="0" width="80" height="15"> <printWhenExpression>Boolean.valueOf($V{PAGE_NUMBER}.intValue() == 1)</printWhenExpression> </reportElement> <textElement textAlignment="Right"/> <textFieldExpression class="java.lang.String"> $V{PAGE_NUMBER}.intValue() == 1 ? "" : ("Page 1 of") </textFieldExpression> </textField> <textField evaluationTime="Report"> <reportElement x="80" y="0" width="75" height="15"/> <textElement textAlignment="Left"/> <textFieldExpression class="java.lang.String"> $V{PAGE_NUMBER}.intValue() == 1 ? "" : (" " + String.valueOf($V{PAGE_NUMBER})) </textFieldExpression> </textField> HTH, Lucian By: Jan - kurellajunior Kirill ment other Problem? 2005-08-18 03:46 I think Kirill is looking for antoher problem. You need a decision that can only be taken after the whole report has been generated. (Show this element only if the overall number of pages is less than...) As far as I understand jasper, this is simply impossible. Due to the fact, that the number of pages is created in time, when it is necessary. During rendering of page one nobody knows, how many pages there will be. For your problem you'll need to render twice, and as far as I know jasper does not do that. (in opposite to TEX) If anybody knows different, I would be glad to know, because had this problem already... Jan By: Lucian Chirita - lucianc RE: Kirill ment other Problem? 2005-08-18 05:35 Hi Jan You are right, the printWhenExpression cannot have delayed evaluation; therefore the decision whether to show an element cannot be taken at Report time. Only the text expression can be evaluated at later time (and this is some kind of double rendering). The solutions I suggested to Kirill are workarounds for this shortcoming. Regards, Lucian 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