ITPub博客

首页 > 应用开发 > IT综合 > 【BO-SDK】-(RAS) Add summary to a group_@old_devlib_03

【BO-SDK】-(RAS) Add summary to a group_@old_devlib_03

原创 IT综合 作者:xiangjinling 时间:2010-09-23 16:29:59 0 删除 编辑
Add new Summaries[@more@]

void addSummary(ReportClientDocument reportClientDocument, IField fieldToSummarize)

throws TutorialException

{

try

{

/*

* Get a DataDefController object for the given report. This controller is needed

* in order to get the summary controller. It is also used to access the report's

* groups, although groups can be accessed for reading without this controller.

*/

DataDefController dataDefController = reportClientDocument.getDataDefController();

//Create a new summary field.

SummaryField summaryField = new SummaryField();

//Set the field that will be used to calculate the summary.

summaryField.setSummarizedField(fieldToSummarize);

/*

* Get a the first group in the report using the DataDefController object.

* Set this group for the summary field using the setGroup method.

*/

IGroup group = dataDefController.getDataDefinition().getGroups().getGroup(0);

summaryField.setGroup(group);

/*

* Set the operation that will be used to calculate the summary. In this

* case, the count operation is chosen.

*/

summaryField.setOperation(SummaryOperation.count);

/*

* Add the new summary to the report using the DataDefController object. The

* argument -1 indicates that the summary will be added to the end of the list of

* summary fields.

*/

dataDefController.getSummaryFieldController().add(-1, summaryField);

}

// If any part of the above procedure failed, redirect the user to an error page.

catch (ReportSDKException e)

{

throw new TutorialException("Error while adding summary.");

}

}

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24167472/viewspace-1038829/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-06-29

  • 博文量
    19
  • 访问量
    26370