2010-12-01 118 views
0

方案 使用dataSetRow我有一些報告與團體馬克& &客戶(字符串) 價格 - 是小數,ID爲intBIRT:創建自定義dataSetRow/JS中


| Mark | [價格] | {expresion} | //標價組中的價格

|客戶| [id] | |


價格有aggregateOn馬克和聚合函數SUM

在{expresion}我需要顯示的[價格]四捨五入值與下一條規則(上渲染腳本):

if(
Total.sum(BirtMath.round(dataSetRow["PRICE"])) != BirtMath.round(Total.sum(dataSetRow["PRICE"]))) 
{ 
this.getStyle().color ='$COLOR$' 
} 

dataSetRow [ 「價格」]具有所有價格。但我只需要那些誰在組標記 somtink喜歡分組(dataSetRow [「價格」,「標記」)

問題: 1:如何在JavaScript函數中做到這一點? 2:如果不可能,如何以另一種方式做到這一點? 謝謝。

回答

0

我會嘗試在報表設計的初始化方法中編寫一個javascript函數。 傳遞參數 「價格」

 
// inizialize 
function myRoundCheck(obj,price) { 
    if(Total.sum(BirtMath.round(price)) != BirtMath.round(Total.sum(price))) { 
    obj.getStyle().color ='$COLOR$'; 
    } 
} 

// on render 
myRoundCheck(this,dataSetRow["PRICE"]); 
+0

達爾birt`s agregation JS庫http://wiki.eclipse.org/BIRT/FAQ/Scripting#Aggregates_.28Totals.29 – 2010-12-03 11:20:21