2015-06-08 17 views
0

有一種情況是表中的任何一個增長,並且我希望該頁在特定點(當兩個表累積的總行數增加超過某個點時)中斷時例如。 40.BIRT pagebreak取決於從表中檢索到的數據

每個頁面都設計成柵格 GRID1有兩個表:

表1:我點擊桌子上,然後轉到腳本標籤的OnCreate。

table1 = this.getRowData().getExpressionValue('row[count]'); // row count contains the number of rows 
reportContext.setPersistentGlobalVariable("table1", table1); 

表2:我點擊桌面並轉到腳本選項卡的onCreate。

table2 = this.getRowData().getExpressionValue('row[count1]'); 
reportContext.setPersistentGlobalVariable("table2", table2); 
table1 = reportContext.getPersistentGlobalVariable("table1"); 
sum = table1 + table2; 
if(sum > 30){ 
    this.getStyle().pageBreakBefore = "always"; 
} 
+0

任何與BIRT的經驗可以請給一些指導, – patz

+0

我不知道這是重要的,但不是this.getRowData()getExpressionValue( 'row [count1]')你可以寫行[count1]等... – hvb

+0

@hvb謝謝。 – patz

回答

0

表2的onCreate:

var totRowCountFromTbl1 = reportContext.getPersistentGlobalVariable("totRowCountTbl1"); 
log(" totRowCountFromTbl1 : "+totRowCountFromTbl1); 

var totRowCountFromtbl2 = this.getRowData().getExpressionValue("row[Aggregation_1]"); 
log(" totRowCountFromtbl2 : "+totRowCountFromtbl2); 

if(totRowCountFromTbl1 != 0){ 
    if(totRowCountFromtbl2 != 0){ 
     var sum = parseInt(totRowCountFromTbl1) + parseInt(totRowCountFromtbl2); 
     if((sum >= 34) && (totRowCountFromTbl1 <= 33)){ 
      this.getStyle().pageBreakBefore = "Always"; 
     } 
    } 
}