Dashboard > Pentaho Reporting Documentation - Latest > Pentaho Reporting Latest > LibFormulaSyntax
Added by Thomas Morgner, last edited by Thomas Morgner on Oct 29, 2007
Labels: 
(None)


The formula syntax used in LibFormula is based on the OpenFormula standard document downloadable from Oasis: OASIS OpenFormula Specifcation

Syntax description

Formulas start with a "=" or an formula prefix (any letter and number followed by a colon.) (not interpreted yet, will be used later to separate different formula-namespaces).

=1
report:1

References to fields are expressed using square brackets.

=[yourfield]

Possible operators are:

Basic computation: +, -, *, /
Percentage: %
Power: ^
String-concatenation: &
Comparisons: =, <>, <, <=, >, >=
Formulas can have braces.

=(1+1)*2 / 3

results in 1.3333333

=10%

results in 0.1

String-constants are expressed using double-quotes.

="Your text here"

Strings can be concatenated using the & operator.

="Your text here " & "some more text"

The Range-Operators are not supported. A formula can only work on the current values of the current datarow. There is no way to access previous or next columns. (These are the same limitations as with all expressions, so this is nothing new.)

The functions we support are:

Category Rounding
INT

Category Information
CHOOSE, HASCHANGED, ISBLANK, ISERR, ISERROR, ISEVEN, ISLOGICAL, ISNA, ISNONTEXT, ISNUMBER, ISODD, ISREF, ISTEXT, NA

Category Text
EXACT, FIND, LEFT, LEN, LOWER, MID, REPLACE, REPT, RIGHT, SUBSTITUTE, T, TEXT, TRIM, UPPER, URLENCODE

Category Mathematical
ABS, AVERAGE, EVEN, MAX, MIN, MOD, ODD, SUM

Category Date/Time
DATE, DATEDIF, DATEVALUE, DAY, HOUR, MONTH, NOW, TIME, TODAY, WEEKDAY, YEAR

Category Logical
AND, FALSE, IF, NOT, OR, TRUE, XOR

The functions are defined inside the OpenFormula standard and should behave as known from Excel or OpenOffice.

Additionally, th report engine also provides the "ISEXPORTTYPE" function, which takes a single parameter specifiying the expected export type.

=ISEXPORTTYPE("table");

returns true on any table-export.

=ISEXPORTTYPE("table/html");

returns true on all HTML-exports.

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.2 Build:#807 May 20, 2007) - Bug/feature request - Contact Administrators