package customAdv; import com.hof.mi.interfaces.AnalyticalFunction; import com.hof.mi.interfaces.UserInputParameters; import com.hof.mi.interfaces.UserInputParameters.Parameter; import com.hof.util.Const; import com.hof.util.UtilString; import java.math.BigDecimal; import java.sql.Date; import java.util.HashMap; public class GroupedPercentageOfTotal extends AnalyticalFunction { private HashMap groupTotals; public String getName() { return "Sectioned Percentage of Total"; } public String getDescription() { return "Calculates the percentage of total against the specified grouping column."; } public String getColumnHeading(String paramString) { return "Derived"+paramString; } public String getCategory() { return UtilString.getResourceString("mi.text.analysis"); } public int getReturnType() { return TYPE_NUMERIC; } public boolean acceptsNativeType(int paramInt) { return paramInt == TYPE_NUMERIC; } protected void setupParameters() { Parameter p = new Parameter(); p.setUniqueKey("REFCOL"); p.setDisplayName(UtilString.getResourceString("mi.text.analytic.function.dividebycolumn.parameter.column.name")); p.setDescription("Reference Column"); p.setDataType(100); p.setAcceptsFieldType(TYPE_DATE, true); p.setAcceptsFieldType(TYPE_TEXT, true); p.setDisplayType(6); addParameter(p); } public void preAnalyticFunction(Object[] selectedCol) { Object[] referenceCol = (Object[]) getParameterValue("REFCOL"); groupTotals = new HashMap(); for (int i=0;i