...
Excerpt |
---|
Uses script code from the Apache-BeanScriptingFramework to calculate values within a single row of a report. |
Note: Seems not to be Release 0.8.9-ga is not working with JavaScript due to a Jar-Version conflict. To resolve it, upgrade to BSF-2.4.0 and Rhino-1.6r7.
The expression will use the last statement as return value. This statement must either be an dummy assignment statement or a method/function call that returns a value.
Examples
Code Block | ||||
---|---|---|---|---|
| ||||
<expression class="org.jfree.report.modules.misc.bsf.BSFExpression" name="totalPrice"> <properties> <property name="language">javascript</property> <property name="expression"> Object getValue() { if (dataRow == null) { return null; } var OrderCount = dataRow.get("QUANTITYORDERED"); var SalePrice = dataRow.get ("PRICEEACH"); if (OrderCount == null || SalePrice == null) { returntotalPrice = null; }return; float} totalPrice = OrderCount * SalePrice; totalPrice = OrderCount return* totalPriceSalePrice; } </property> </properties> </expression> |