Jump to content

iReport Last Page


yukini

Recommended Posts

Hi,

first of all I use iReport 3.0.0 and the JasperServer 3.1.

I am having an issue at work that I am not able to solve. I have searched for a solution in a lot of forums, but I often found old posts, and was asked to open a new thread (older post with an equal problem: http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=18975&page=2). If someone gets to the conclusion that it won't work with the 3.0.0 version of iReport: I am definitely not able to upgrade to a newer Version !

The  Task:

I have to place two lines at the Page Header section for all pages besides the last page. There I have to place 4 lines.

I tried to solve it in different way, but somehow the field element returns a right value, but all the same gets printed. I defined a new variable called last_page with the following properties:
class of the variable: java.lang.Integer

calculation typ: maximum

reset type: none

counting typ: report

expression for value: new java.lang.Integer($V{PAGE_NUMBER}.intValue() + (new Integer(1).intValue()) ) (I added plus one because somehow it starts to count at the secondpage, so last page would always count -1)

The printed element has the print expression: new Boolean ($V{PAGE_NUMBER}.toString().equalsIgnoreCase($V{last_page}.toString()))

The evaluation time: auto

The expression that gets printed: $V{PAGE_NUMBER}.intValue() == $V{last_page}.intValue() ? "1" : "0"

When I generate the PDF the field returns right values. For example: When I have 4 Pages the return value of the elments look like..

Page 1: 0

Page 2: 0

Page 3: 0

Page 4(that is the last page): 1

-> So everything was ok, but for some reason the printing expression does not do as wished. It only do unprint the first page and the following pages, that also have the value = 0 get printed.

Please, I realy need help in that case.

(By the way, my english is just secondary :( )

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

What you tried didn't work because the element "print when" expression does not support delayed evaluation.  So when you set evaluationTime for a text element, it will only apply to the text expression.  The "print when" expression is always evaluated at the time the band renders.

What you want might be possible in JR 3.5.2 in which delayed conditional style evaluation has been implemented.  But I don't have any idea for older JR versions.

Regards,

Lucian

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...