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

相關文章
相關標籤/搜索