问题描述:

There is a case when either of the table grows and I want that page to break at a certain point when the total row count (of both tables accumulated) grows beyond a certain point eg. 40.

Each page is designed as a grid

Grid1 has two tables:

Table 1: I click on the table and go to the onCreate of script tab.

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

reportContext.setPersistentGlobalVariable("table1", table1);

Table 2: I click on the table and go to the onCreate of script tab.

table2 = this.getRowData().getExpressionValue('row[count1]');

reportContext.setPersistentGlobalVariable("table2", table2);

table1 = reportContext.getPersistentGlobalVariable("table1");

sum = table1 + table2;

if(sum > 30){

this.getStyle().pageBreakBefore = "always";

}

网友答案:

onCreate OF TABLE 2:

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";
        }
    }
}
相关阅读:
Top