打印组后计算 JasperReports scriptlet 中的值

Calculating value in JasperReports scriptlet AFTER a group is printed

我有以下 JasperReport 脚本,它工作正常:

public class ReportScriptlet extends JRDefaultScriptlet {

    public void beforeGroupInit(String groupName)  throws JRScriptletException {
        System.out.println("in beforeGroupInit - " + groupName);
    }

    public void afterGroupInit(String groupName)  throws JRScriptletException {
        System.out.println("in afterGroupInit - " + groupName);
    }

}

问题是 beforeGroupInitafterGroupInit 运行 在打印组的行之前,我需要在打印这些行之后进行计算。

由于没有 afterGroupFinalized 事件,是否有不同的方法来实现此目的?

你为什么不使用 GroupFooter?您可以创建一个新变量,设置您的计算并在变量表达式中设置正确的字段