13.07.2015 Views

iReport Ultimate Guide - Nimsoft Library

iReport Ultimate Guide - Nimsoft Library

iReport Ultimate Guide - Nimsoft Library

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>iReport</strong> <strong>Ultimate</strong> <strong>Guide</strong>PAGE_NUMBER variable that defines the value of the current page number. So we have to force UR to wait to fill thatparticular element until the calculation process completes.Using the example of Page X of Y, we need two textfields:• A textfield to print the current page number (or better the string “Page X of”), where X is the current value of the variablePAGE_NUMBER.• A second textfield to print Y (the total number of pages).For the second textfield we set the evaluation time to REPORT, which signifies “when the last page has been reached.”At thattime, the value of PAGE_NUMBER will contain the total number of pages.You can use this method to set the evaluation time for any textfield or image. For example, you can use it to print a subtotal inthe header of a group. The calculation requires the records in the group to be processed first, but it is possible to place atextfield showing the variable associated with the calculation in a textfield of the group header, with the evaluation time set toGROUP (and the evaluation group to the proper group).Two particular evaluation times deserve special attention: BAND and AUTO:• BAND forces UR to evaluate a variable that is the result of a calculation performed after processing the entireband. This is often used in the Detail band in two cases: a value returned from a subreport (for example, the number ofrecords printed in the subreport) and a value of a variable that was set by an external agent, such as a scriptlet.• AUTO evaluation time occurs when the last record of the given dataset is processed; the time is defined by the reset type,which, in these cases, would usually be REPORT or GROUP. It allows you to mix values that are determined at differenttimes, such as the current value of a field and the calculated value of a variable. The most common use is calculating apercentage. Suppose we have a list of numbers, and we want to print the percentage of incidence for each single numberwith respect to the total of all the numbers. You can calculate the percentage by dividing the current value of evaluationtime NOW by a variable that calculates the total when the report completes.Here comes the conflict: we need to consider two values having different evaluation times. The AUTO evaluation timeprovides the solution. UR will use the evaluation time NOW for the field named in the expression, while waitingto evaluate the variable until the evaluation time that corresponds to the field’s reset type.For another use of evaluation times and reset types, see 19.2.2, “Printing Page X of Y in a Single Textfield,” on page 347.110

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!