At this section, we will learn how to define group and calculation. It's not difficult for grouping and calculating field.
@Kismiss(name = "Employee", columnAutoSize=true)
@Header
@Group(calculation = {"capacity : Sum"}, groupBy="firstName", calculationPrintType=CalculationPrintType.Complete)
public class Employee {
...
}
calculation defining in a group, this example tell us that the employee report group by “firstName” and calculate the “capacity” with “Sum” caculation type.
If the group want to omitted we can set isShowInDetail in Property Tag to “false”. This tell kismiss not to display and operate the field.
See the example report that using group and calculation :
Look at the report result, we can see that the report group by “firstName” and Sum the “capacity” based on “firstName”. This is not a difficult way to do.
We can also calculate the capacity field by adding calculation tag to “getCapacity” method, this calculation will calculate all the data. Modify the code as below :
package com.softtech.kismiss.seventhExample;
import com.softtech.kismiss.enumer.CalculationType;
import com.softtech.kismiss.property.Header;
import com.softtech.kismiss.property.Calculation;
import com.softtech.kismiss.property.Kismiss;
import com.softtech.kismiss.property.Property;
@Kismiss(name = "Employee", columnAutoSize=true)
@Header
@Detail(lineWidth=0.5)
public class Employee { …
@Property(width = 35, position = 8)
@Calculation(attribute = "capacity", calculationType = CalculationType.Sum)
public int getCapacity() {
return capacity;
} …
}
The report will be shown as :
Tidak ada komentar:
Posting Komentar