Java 打印组后在JasperReports scriptlet中计算值

Java 打印组后在JasperReports scriptlet中计算值,java,jasper-reports,Java,Jasper Reports,我有以下JasperReport scriptlet,它运行良好: public class ReportScriptlet extends JRDefaultScriptlet { public void beforeGroupInit(String groupName) throws JRScriptletException { System.out.println("in beforeGroupInit - " + groupName); }

我有以下JasperReport scriptlet,它运行良好:

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);
    }

}
问题是在打印组的行之前运行
beforeGroupInit
afterGroupInit
,打印行之后我需要进行计算


既然groupfinalized之后没有
事件,有没有其他方法来实现这一点?

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

谢谢,这就是我所做的。我在组页脚的变量中设置了一个表达式,如
$P{REPORT\u SCRIPTLET}.myFunction()
,它触发了计算