Hi,
I have written the following Code, wondering, why it computed two times the Sum of the the column
In allegate i put the produced report (You will find two times VarianceExp)
protected void createBody(ReportDesignHandle design) throws SemanticException {
TableHandle table = design.getElementFactory().newTableItem("dataTable", 5, 1, 1, 1);
table.setProperty(StyleHandle.TEXT_ALIGN_PROP, DesignChoiceConstants.TEXT_ALIGN_CENTER);
table.setWidth("80%");
table.setProperty(TableHandle.DATA_SET_PROP, "setScripted");
// bind the data set columns to the table
DataSetHandle dataSetHandle = (DataSetHandle) design.getDataSets().get(0);
List resultSetCols = dataSetHandle.getListProperty(DataSetHandle.RESULT_SET_PROP);
PropertyHandle boundCols = table.getColumnBindings();
for (Iterator iterator = resultSetCols.iterator(); iterator.hasNext();) {
ResultSetColumn rsHandle = (ResultSetColumn) iterator.next();
ComputedColumn col = StructureFactory.createComputedColumn();
col.setName(rsHandle.getColumnName());
col.setExpression("dataSetRow[\"" +
rsHandle.getColumnName() + "\"]");
boundCols.addItem(col);
}
//Aggregate fields for footer of group
ComputedColumn groupVarianceExp = StructureFactory.createComputedColumn();
groupVarianceExp.setName("VarianceExp");
groupVarianceExp.setDisplayName("VarDisp");
groupVarianceExp.setExpression("dataSetRow[\"Real\"]");
groupVarianceExp.setAggregateFunction(DesignChoiceConstants.MEASURE_FUNCTION_MIN);
groupVarianceExp.setAggregateOn("GroupPerValue");
boundCols.addItem(groupVarianceExp);
ComputedColumn groupMedianExp = StructureFactory.createComputedColumn();
groupMedianExp.setName("MedianExp");
groupMedianExp.setDisplayName("MedDisp");
groupMedianExp.setExpression("dataSetRow[\"Real\"]");
groupMedianExp.setAggregateFunction(DesignChoiceConstants.MEASURE_FUNCTION_SUM);
groupMedianExp.setAggregateOn("GroupPerValue");
boundCols.addItem(groupMedianExp);
// Table sorter
SortKey key = StructureFactory.createSortKey();
key.setKey("row[\"Log-ID\"]");
key.setDirection("asc");
PropertyHandle sort = table.getPropertyHandle(TableHandle.SORT_PROP);
sort.addItem(key);
// Header
RowHandle rowHandle = (RowHandle) table.getHeader().get(0);
CellHandle tblCellHandle = (CellHandle) rowHandle.getCells().get(0);
LabelHandle labelHandle = design.getElementFactory().newLabel(null);
labelHandle.setText("Name");
labelHandle.setStyleName("LabelStyle");
tblCellHandle.getContent().add(labelHandle);
tblCellHandle = (CellHandle) rowHandle.getCells().get(1);
labelHandle = design.getElementFactory().newLabel(null);
labelHandle.setText("Log-ID");
labelHandle.setStyleName("LabelStyle");
tblCellHandle.getContent().add(labelHandle);
tblCellHandle = (CellHandle) rowHandle.getCells().get(2);
labelHandle = design.getElementFactory().newLabel(null);
labelHandle.setText("Expected");
labelHandle.setStyleName("LabelStyle");
tblCellHandle.getContent().add(labelHandle);
tblCellHandle = (CellHandle) rowHandle.getCells().get(3);
labelHandle = design.getElementFactory().newLabel(null);
labelHandle.setText("Exp.at Start");
labelHandle.setStyleName("LabelStyle");
tblCellHandle.getContent().add(labelHandle);
tblCellHandle = (CellHandle) rowHandle.getCells().get(4);
labelHandle = design.getElementFactory().newLabel(null);
labelHandle.setText("Real");
labelHandle.setStyleName("LabelStyle");
tblCellHandle.getContent().add(labelHandle);
// Table Group
TableGroupHandle group = design.getElementFactory().newTableGroup();
group.setName("GroupPerValue");
group.setKeyExpr("row[\"Name\"]");
table.getGroups().add(group);
RowHandle grpHdrHandle = design.getElementFactory().newTableRow(5);
tblCellHandle = (CellHandle) grpHdrHandle.getCells().get(0);
tblCellHandle.setDrop(DesignChoiceConstants.DROP_TYPE_DETAIL);
DataItemHandle data = "">
data.setStyleName("DataStyle");
data.setResultSetColumn("Name");
tblCellHandle.getContent().add(data);
group.getHeader().add(grpHdrHandle);
//Median
Footer
RowHandle groupMedFooter = design.getElementFactory().newTableRow(5);
tblCellHandle = (CellHandle) groupMedFooter.getCells().get(0);
tblCellHandle = (CellHandle) groupMedFooter.getCells().get(1);
tblCellHandle.setProperty(StyleHandle.TEXT_ALIGN_PROP, DesignChoiceConstants.TEXT_ALIGN_LEFT);
tblCellHandle.getContent().add(createLabel("Median", "Median"));
tblCellHandle = (CellHandle) groupMedFooter.getCells().get(2);
DataItemHandle dataHandle = design.getElementFactory().newDataItem("MedExp");
dataHandle.setResultSetColumn("MedianExp");
dataHandle.setDisplayName("Median");
tblCellHandle.getContent().add(dataHandle);
tblCellHandle = (CellHandle) groupMedFooter.getCells().get(3);
tblCellHandle = (CellHandle) groupMedFooter.getCells().get(4);
group.getFooter().add(groupMedFooter);
//Variance Footer
RowHandle groupVarFooter = design.getElementFactory().newTableRow(5);
tblCellHandle = (CellHandle) groupVarFooter.getCells().get(0);
tblCellHandle = (CellHandle) groupVarFooter.getCells().get(1);
tblCellHandle.setProperty(StyleHandle.TEXT_ALIGN_PROP,
DesignChoiceConstants.TEXT_ALIGN_LEFT);
tblCellHandle.getContent().add(createLabel("Variance", "Variance"));
tblCellHandle = (CellHandle) groupVarFooter.getCells().get(2);
DataItemHandle dataVarHandle = design.getElementFactory().newDataItem("VarExp");
dataVarHandle.setResultSetColumn("VarianceExp");
dataVarHandle.setDisplayName("Variance");
tblCellHandle.getContent().add(dataVarHandle);
tblCellHandle = (CellHandle) groupVarFooter.getCells().get(3);
tblCellHandle = (CellHandle) groupVarFooter.getCells().get(4);
group.getFooter().add(groupVarFooter);
//second footer
RowHandle groupFooter = design.getElementFactory().newTableRow(5);
tblCellHandle = (CellHandle) groupFooter.getCells().get(0);
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_COLOR_PROP, "#FF8000");
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_STYLE_PROP, DesignChoiceConstants.LINE_STYLE_SOLID);
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_WIDTH_PROP, DesignChoiceConstants.LINE_WIDTH_THIN);
tblCellHandle = (CellHandle) groupFooter.getCells().get(1);
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_COLOR_PROP, "#FF8000");
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_STYLE_PROP, DesignChoiceConstants.LINE_STYLE_SOLID);
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_WIDTH_PROP, DesignChoiceConstants.LINE_WIDTH_THIN);
tblCellHandle = (CellHandle) groupFooter.getCells().get(2);
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_COLOR_PROP, "#FF8000");
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_STYLE_PROP, DesignChoiceConstants.LINE_STYLE_SOLID);
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_WIDTH_PROP, DesignChoiceConstants.LINE_WIDTH_THIN);
tblCellHandle = (CellHandle) groupFooter.getCells().get(3);
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_COLOR_PROP, "#FF8000");
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_STYLE_PROP, DesignChoiceConstants.LINE_STYLE_SOLID);
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_WIDTH_PROP, DesignChoiceConstants.LINE_WIDTH_THIN);
tblCellHandle = (CellHandle) groupFooter.getCells().get(4);
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_COLOR_PROP, "#FF8000");
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_STYLE_PROP, DesignChoiceConstants.LINE_STYLE_SOLID);
tblCellHandle.setProperty(StyleHandle.BORDER_BOTTOM_WIDTH_PROP, DesignChoiceConstants.LINE_WIDTH_THIN);
group.getFooter().add(groupFooter);
// Add DataItems to the Detail Row
// first column
RowHandle detail = (RowHandle) table.getDetail().get(0);
tblCellHandle = (CellHandle) detail.getCells().get(1);
data = ""> data.setStyleName("DataStyle");
data.setResultSetColumn("Log-ID");
tblCellHandle.getContent().add(data);
tblCellHandle = (CellHandle) detail.getCells().get(2);
data = "">
data.setStyleName("DataStyle");
data.setResultSetColumn("Exp");
tblCellHandle.getContent().add(data);
// second column
tblCellHandle = (CellHandle) detail.getCells().get(3);
data = ""> data.setStyleName("DataStyle");
data.setResultSetColumn("ExpSt");
tblCellHandle.getContent().add(data);
// second column
tblCellHandle = (CellHandle) detail.getCells().get(4);
data = "">
data.setStyleName("DataStyle");
data.setResultSetColumn("Real");
tblCellHandle.getContent().add(data);
design.getBody().add(table);
}
----- Ursprüngliche Mail ----
Von: Xiaoying Gu <xgu@xxxxxxxxxxx>
An: birt-dev@xxxxxxxxxxx
Gesendet: Samstag, den 24. Mai 2008, 14:42:32 Uhr
Betreff: [birt-dev] New Eclipse BIRT Milestone Build Available for Download
BIRT
Community,
The BIRT development
team are pleased to let you know that BIRT 2.3 RC1 Build (build number:
20080522-1340) is now available for download.
Build <2.3RC1 >
can be downloaded from the BIRT download page: http://download.eclipse.org/birt/downloads/build.php?build=M-R1-2.3RC1-200805221340
As always, please
provide your feedback through the newsgroup or by reporting bugs through
Bugzilla.
Regards,
BIRT
Team