private JRVariable createHelperVariable( JRVariable variable, String nameSuffix, byte calculation) { JRDesignVariable helper = new JRDesignVariable(); helper.setName(variable.getName() + nameSuffix); helper.setValueClassName(variable.getValueClassName()); helper.setIncrementerFactoryClassName(variable.getIncrementerFactoryClassName()); helper.setResetType(variable.getResetType()); helper.setResetGroup(variable.getResetGroup()); helper.setIncrementType(variable.getIncrementType()); helper.setIncrementGroup(variable.getIncrementGroup()); helper.setCalculation(calculation); helper.setSystemDefined(true); helper.setExpression(variable.getExpression()); return helper; }
private JRVariable createDistinctCountHelperVariable(JRVariable variable) { JRDesignVariable helper = new JRDesignVariable(); helper.setName(variable.getName() + "_DISTINCT_COUNT"); helper.setValueClassName(variable.getValueClassName()); helper.setIncrementerFactoryClassName(JRDistinctCountIncrementerFactory.class.getName()); helper.setResetType(JRVariable.RESET_TYPE_REPORT); if (variable.getIncrementType() != JRVariable.RESET_TYPE_NONE) helper.setResetType(variable.getIncrementType()); helper.setResetGroup(variable.getIncrementGroup()); helper.setCalculation(JRVariable.CALCULATION_NOTHING); helper.setSystemDefined(true); helper.setExpression(variable.getExpression()); return helper; }