JasperReport 参数与变量

报表固定参数:

 1. REPORT_CONNECTION
      Connection connection = dataSource.getConnection()
      parameters.put("REPORT_CONNECTION", connection);
2. REPORT_LOCALE 国际化用到的
3. REPORT_TIME_ZONE 定义时区
4. REPORT_RESOURCE_BUNDLE 国际化资源,可能跟报表的Resource bundle属性有关。
5. REPORT_VIRTUALIZER Jasper report的虚拟机,填充报表的时候用来优化内存消耗。
     JRFileVirtualizer virtualizer = new JRFileVirtualizer(100, folderPath);
     parameters.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);
6. REPORT_MAX_COUNT 只容许报表显示多少条数据
     好比设定REPORT_MAX_COUNT为20,则报表只会显示前20条数据,虽然可能查出了100条。
7. IS_IGNORE_PAGINATION 设置这个参数为true的时候,报表的类容将会在长长的一页中显示而不会分页。


变量:

Variable Expression:  express

the function used to define the variable value, it can be composed of more fields and variables, and could be used logic operators, math operators and so on. To easly define the expression an expression editor is provided in Jaspersoft Studio, this can be opened using the button at the right of the text Field used to write the expression. The expression is evaluated on each iteration, every time a record is readed from the datasource. If there isn't a calculation function defined (this will be explained below) the result of the expression will be assigned to the variable, so it's important that the result has a type compatible with the one in the variable. ide

每次读取一条记录,Variable Expression的表达式就会执行一次,若是CALCULATION没有定义,那么Variable Expression的表达式计算出来的值就是本次变量的值。若是CALCULATION有定义,那变量的结果是合计后的值。

Increment Type : 优化

when a calculation function is defined, the the value of the expression is passed to the function that will do the calculation for the variable.
Increment Type是为CALCULATION定义的。


1. RESETTYPE 定义变量何时重置为初始状态
2. CALCULATION 定义变量的合计方式。
3. INCREMENTTYPE 定义CALCULATION所描述的合计方式何时计算一次,传入的值是Variable Expression计算出来的值。
4. Variable Expression 定义每次计算的时候该怎样计算,每取一条记录执行一次。 this

    RESETTYPE下各个选项意义:
    None : 对于每条记录都会从新计算一次,一个group中可能有n条记录。
    Report :变量只重置一次,且是在报表起始的时候重置。
    Page : 在每一个页面起始的时候重置。
    Group : 一个分组重置一次。
    Column : 还不清楚,暂时发现跟Page是同样的功能。可是column的定义是在每一页列开始的时候重置。 暂时不知道怎么用。

    INCREMENTTYPE各个选项意义:
    Column : 对于CALCULATION定义的合计方式,每列后从新计算一次。
    Group : 对于CALCULATION定义的合计方式,每个分组从新计算一次。
    None : 对于CALCULATION定义的合计方式,每读取一条记录从新计算一次。
    Page : 对于CALCULATION定义的合计方式,每页结束从新计算一次。
    Report : 对于CALCULATION定义的合计方式,只从新计算一次,而且是在报表的结束从新计算。 lua

相关文章
相关标签/搜索