DynamicJasper icon indicating copy to clipboard operation
DynamicJasper copied to clipboard

Last group footer label always incorrect when the group size is 1

Open Spanner0jjm opened this issue 5 years ago • 1 comments

When adding a footer label to groups, when the last group in the report contains just one element, the footer label is always incorrect (the label from the penultimate group is repeated).

Since the CustomExpression class is an interface, there is no way to correct this behaviour.

Below I include an extract of a typical DJGroup definition which creates a footer label with a CustomExpression, and a screenshot of the result it produces. You can see that the last footer label is incorrect.

The error is consistently replicated when the last group contains just one element.

Typical DJGroup creation:

DJGroup g1 = gb1.setCriteriaColumn((PropertyColumn) columnCamara).setGroupLayout(GroupLayout.VALUE_IN_HEADER)
		.addFooterVariable(columnComisionTotal, DJCalculation.SUM, groupVariables).setFooterVariablesHeight(20)
		.setFooterLabel(new DJGroupLabel(new CustomExpression() {
			private static final long serialVersionUID = -6204511174702760074L;
			
			@Override
			public String getClassName() {
				return String.class.getName();
			}
			
			@Override
			public Object evaluate(Map fields, Map variables, Map parameters) {
				return "Total " + fields.get("camara");
			}
		}, groupVariablesLabel, LabelPosition.LEFT)).build();

Incorrect last footer: Ultimo grupo incorrecto Any help would be appreciated.

Spanner0jjm avatar Jun 27 '19 07:06 Spanner0jjm

I was able to reproduce this and did some fixes... If you are familiar with JasperReport internals, this is a pain in the neck. Please try new versions to check if the problem is solved

juanalvarezg avatar Mar 23 '20 21:03 juanalvarezg