This algorithm can be used to write simple formulas, examples are :
20% VAT calculation : eval="(amount / 100) * 20"
100$ volume discount : eval="If(amount > 1000,100,0)"
(read: if amount is greater than 1000 then the result will be 100, otherwise 0)
Number of boxes needed to carry that number of items : eval="Ceiling(items / boxsize)"
Number of items you can add before another box is needed : eval="Reminder(items,boxside)"
Note: please take care that xreporter expressions are not that accurate when it comes to decimals. The default
divide operator rounds the result, see http://issues.cocoondev.org/browse/XRP-115. Also consider that the
available set of functions can be expanded implementing and using new ones. Please see
http://outerthought.net/wqm/xreporter/en/expressions.html for an overview of xreportes expressions and
IsNullFunction or
StringFunction
for examples of custom xreporter functions.
Checks wether this algorithm is able to return the given datatype. For example,
an arithmetic algorithm like sum should check that the given datatype is a number.
Parameters:
dataType - The target datatype.
Returns:
true if this algorithm can return a compatible value, false otherwise.