|
||||||||||
| 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.PercentageExpression
public class PercentageExpression
Computes the percentage for a column in relation to a base column.
The function undestands two parameters. Thedividend parameter is required and denotes the name of an
ItemBand-field which is used as dividend. The divisor parameter is required and denotes the name of an
ItemBand-field which is uses as divisor.
If either the divident or the divisor are not numeric, the expression will return null.
The formula used is as follows:
Percent := divident / divisorIf the flag
useDifference is set, the difference between base and subject is used instead.
Percent := (divisor - divident) / divisor
| Constructor Summary | |
|---|---|
PercentageExpression()
Deprecated. Constructs a new function. |
|
| Method Summary | |
|---|---|
String |
getDividend()
Deprecated. Returns the field used as dividend by the function. |
String |
getDivisor()
Deprecated. Returns the field used as divisor by the function. |
int |
getRoundingMode()
Deprecated. Returns the defined rounding mode. |
int |
getScale()
Deprecated. Returns the scale for the divide-operation. |
Object |
getValue()
Deprecated. Return the current function value. |
boolean |
isUseDifference()
Deprecated. Returns whether the difference between divident and divisor should be used as real divisor. |
void |
setDividend(String dividend)
Deprecated. Sets the field name to be used as dividend for the function. |
void |
setDivisor(String divisor)
Deprecated. Sets the field name to be used as divisor for the function. |
void |
setRoundingMode(int roundingMode)
Deprecated. Defines the rounding mode. |
void |
setScale(int scale)
Deprecated. Defines the scale for the divide-operation. |
void |
setUseDifference(boolean useDifference)
Deprecated. Defines whether the difference between divident and divisor should be used as real divisor. |
| Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression |
|---|
clone, getDataRow, getDependencyLevel, getInstance, 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 |
| Constructor Detail |
|---|
public PercentageExpression()
Initially the function has no name...be sure to assign one before using the function.
| Method Detail |
|---|
public boolean isUseDifference()
public void setUseDifference(boolean useDifference)
useDifference - true, if the difference is used, false if the divident is used directly.public int getRoundingMode()
BigDecimal.divide(java.math.BigDecimal,int)public void setRoundingMode(int roundingMode)
roundingMode - the rounding mode.BigDecimal.divide(java.math.BigDecimal,int)public int getScale()
public void setScale(int scale)
scale - the scale.public String getDividend()
The field name corresponds to a column name in the report's data-row.
public String getDivisor()
The field name corresponds to a column name in the report's data-row.
public void setDividend(String dividend)
The field name corresponds to a column name in the report's data-row.
dividend - the field name.public void setDivisor(String divisor)
The field name corresponds to a column name in the report's data-row.
divisor - the field name.public Object getValue()
The value is calculated as the quotient of two columns: the dividend column and the divisor column. If the divisor is zero, the return value is "n/a";
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||