DynamicJasper
DynamicJasper copied to clipboard
Setting value as Group Label using CustomExpression
Hi I tried to use CustomExpression for group label, to display my label for the group total using this format: "Status: Open"
Unfortunately, the label turns out blank. Is there anyway for me to troubleshoot? My parameter has empty default string, and I cannot tell how the expression: (ar.com.fdvs.dj.domain.CustomExpression)$P{REPORT_PARAMETERS_MAP}.get... is evaluating the custom expression. My snippet (modified) is below:
GroupBuilder gb = new GroupBuilder();
gb.setCriteriaColumn(groupColumn);
gb.addFooterVariable(numberColumn, DJCalculation.SUM, style);
String columnName = strColumnName;
CustomExpression ce = new CustomExpression() {
public Object evaluate(Map fields, Map variables, Map parameters) {
return columnName + ": " + fields.get(columnName);
}
public String getClassName() {
return dataType;
}
};
DJGroupLabel groupLabel = new DJGroupLabel(ce, style, LabelPosition.LEFT);
gb.setFooterLabel(groupLabel);