|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pentaho.reporting.engine.classic.core.function.AbstractExpression
org.pentaho.reporting.engine.classic.core.function.AbstractFunction
org.pentaho.reporting.engine.classic.core.function.ItemSumFunction
public class ItemSumFunction
A report function that calculates the sum of one field (column) from the data-row. This function produces a running total, no global total. For a global sum, use the TotalGroupSumFunction function. The function can be used in two ways:
field
parameter is required and denotes the name of an
ItemBand-field which gets summed up.
The parameter group
denotes the name of a group. When this group is started, the counter gets reseted to
null.
Constructor Summary | |
---|---|
ItemSumFunction()
Constructs an unnamed function. |
|
ItemSumFunction(String name)
Constructs a named function. |
Method Summary | |
---|---|
String |
getField()
Returns the field used by the function. |
String |
getGroup()
Returns the group name. |
Expression |
getInstance()
Return a completly separated copy of this function. |
Object |
getValue()
Returns the function value, in this case the running total of a specific column in the report's data-row. |
void |
groupStarted(ReportEvent event)
Receives notification that a new group is about to start. |
void |
itemsAdvanced(ReportEvent event)
Receives notification that a row of data is being processed. |
void |
reportInitialized(ReportEvent event)
Receives notification that a new report is about to start. |
void |
setField(String field)
Sets the field name for the function. |
void |
setGroup(String name)
Sets the group name. |
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractFunction |
---|
groupFinished, itemsFinished, itemsStarted, reportDone, reportFinished, reportStarted |
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression |
---|
clone, getDataRow, getDependencyLevel, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setActive, setDependencyLevel, setName, setPreserve, setRuntime |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.pentaho.reporting.engine.classic.core.event.ReportListener |
---|
groupFinished, itemsFinished, itemsStarted, reportDone, reportFinished, reportStarted |
Methods inherited from interface org.pentaho.reporting.engine.classic.core.function.Expression |
---|
clone, getDataRow, getDependencyLevel, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setDependencyLevel, setName, setRuntime |
Constructor Detail |
---|
public ItemSumFunction()
public ItemSumFunction(String name)
The field must be defined before using the function.
name
- The function name.Method Detail |
---|
public void reportInitialized(ReportEvent event)
Does nothing.
reportInitialized
in interface ReportListener
reportInitialized
in class AbstractFunction
event
- Information about the event.public void groupStarted(ReportEvent event)
groupStarted
in interface ReportListener
groupStarted
in class AbstractFunction
event
- Information about the event.public String getGroup()
getGroup
in interface AggregationFunction
public void setGroup(String name)
If a group is defined, the running total is reset to zero at the start of every instance of this group.
setGroup
in interface AggregationFunction
name
- the group name (null permitted).public String getField()
getField
in interface FieldAggregationFunction
public void setField(String field)
setField
in interface FieldAggregationFunction
field
- the field name.public void itemsAdvanced(ReportEvent event)
This function assumes that it will find an instance of the Number class in the column of the data-row specified by the field name.
itemsAdvanced
in interface ReportListener
itemsAdvanced
in class AbstractFunction
event
- Information about the event.public Object getValue()
getValue
in interface Expression
public Expression getInstance()
getInstance
in interface Expression
getInstance
in class AbstractExpression
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |