net.sf.jasperreports.engine

## Interface JREvaluation

- All Known Subinterfaces:
    JRChart, JRImage, JRTextField
  All Known Implementing Classes:
    JRBaseChart, JRBaseImage, JRBaseTextField, JRDesignChart, JRDesignImage, JRDesignTextField, JRFillChart, JRFillImage, JRFillTextField

      public interface JREvaluation

  Provides support for expressions evaluation.

  Normally, all report expressions are evaluated immediately, using the current values of all the parameters, fields, and variables at that particular moment. It is like making a photo of all data for every iteration in the data source during the report-filling process. This means that at any particular time, you won't have access to values that are going to be calculated later in the report-filling process. This makes perfect sense, since all the variables are calculated step by step and reach their final value only when the iteration arrives at the end of the data source range they cover.

  For example, a report variable that calculates the sum of a field for each page will not contain the expected sum until the end of the page is reached. That's because the sum is calculated step by step as the data source records are iterated through. At any particular time, the sum will only be partial, since not all the records of the specified range will have been processed.

  As a consequence, you cannot display a sum on the page header, since this value will be known only when the end of the page is reached. At the beginning of the page, when generating the page header, the sum variable would contain zero, or its initial value. To address this problem, JasperReports provides a feature (the `evaluationTime` attribute) that lets you decide the exact moment you want the text field expression to be evaluated, avoiding the default behavior in which the expression is evaluated immediately when the current report section is generated.

  The `evaluationTime` attribute can have one of the following values (see `getEvaluationTimeValue()`):
  - `Now` - The expression is evaluated when the current band is filled.
  - `Report` - The expression is evaluated when the end of the report is reached.
  - `Page` - The expression is evaluated when the end of the current page is reached
  - `Column` - The expression is evaluated when the end of the current column is reached
  - `Group` - The expression is evaluated when the group specified by the `evaluationGroup` attribute (see `getEvaluationGroup()`) changes
  - `Auto` - Each variable participating in the expression is evaluated at a time corresponding to its reset type. Fields are evaluated `Now`. This evaluation type should be used for expressions that combine values evaluated at different times, like the percentage out of a total
  The default value for this attribute is `Now`. In the example presented previously, you could easily specify `evaluationTime="Page"` for the text field placed in the page header section, so that it displays the value of the sum variable only when reaching the end of the current page.
  Version:
    $Id: JREvaluation.java 7076 2014-05-06 10:10:35Z shertage $
  Author:
    Teodor Danciu (teodord@users.sourceforge.net)

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `JRGroup` | `getEvaluationGroup()` Gets the evaluation group for this text field.
    `EvaluationTimeEnum` | `getEvaluationTimeValue()` Gets the evaluation time for this text field.

- - ### Method Detail

    - #### getEvaluationTimeValue

          EvaluationTimeEnum getEvaluationTimeValue()

      Gets the evaluation time for this text field.
      Returns:
        one of the evaluation time constants in `JRExpression`

    - #### getEvaluationGroup

          JRGroup getEvaluationGroup()

      Gets the evaluation group for this text field. Used only when evaluation time is group.
      See Also:
        `EvaluationTimeEnum.GROUP`

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com