I use eclipse 4.4.1, windows 8.1, java 7, birt 4.4.1 and the Example Database of BIRT. I want to make all in java.
I have a report with a table with 6 columns
Columns 1-5 with Databinding
Column 6 with the following Expression:
BirtMath.multiply(dataSetRow["QUANTITYORDERED"],dataSetRow["PRICEEACH"])
with DataType float and name "TOTAL_ROW"
In the table footer I added a Data with following ExpressionTotal.sum(row["TOTAL_ROW"])
with DataType float and name "TOTAL"
In the Row i added the following RowEventHandle
@Override
public void onCreate(IRowInstance arg0, IReportContext arg1)
throws ScriptException {
try {
Double price = (Double) arg0.getRowData().getExpressionValue(
"row[TOTAL_ROW]");
Double totalPrice1 = (Double) arg0.getRowData().getExpressionValue(
"row[TOTAL]");
Double totalPrice2 = (Double) arg0.getParent()
.getNamedExpressionValue("TOTAL");
if (price.doubleValue() > totalPrice1.doubleValue() / 50)
arg0.getStyle().setBackgroundColor("red");
} catch (ScriptException e) {
e.printStackTrace();
}
}
For the variables price and totalPrice1 I get the correct values.
But for the variable totalPrice2 I get always null
Attached I send the Report-File