Report Eval

Description

Performs mathematical operations on reporting data. The results may be saved as a variable, accessible in the current context.


Parameters

NameRequiredAvailable InMigratable to Cloud?Default ValueDescription

[default] /name

 (error)

Server, Data Center


If provided, the result of the evaluation will be stored in a variable with the specified name. It is accessible via the Variable Supplier (e.g.: "variable:foo").

default

 (error)

Server, Data Center


An %injectable% value that will be used if the expression does not evaluate to a valid result.

format

 (error)

Server, Data Center


A number format to output the result with.

e.g.: "#,##0.00".

hidden

 (error)

Server, Data Center

false

If set to true, the result will not be output.

Notes

This macro differs from Scaffolding's Eval Data in a couple of ways.

  1. The value is only stored temporarily. It can't be accessed from another page, for example.
  2. It can access values outside of the Scaffolding add-on. Any number you can access from a Supplier can be used in a calculation.
  3. There are no special functions for sumtable or avgtable. Instead, use the Stats On Supplier to generate that kind of data.

Expressions

Expressions can be made up of the following:

Description

Value

Numbers

1.234, -987

Variables

%prefix:value%

Basic operations

+, -, *, /, ^

Trigonometry functions

sin(X), cos(X), tan(X), cot(X), sec(X), csc(X), arcsin(X), arccos(X), arctan(X)

Exponential functions

sqrt(X), exp(X), ln(X), log2(X), log10(X)

Shift functions

abs(X), trunc(X), round(X), floor(X), ceiling(X)

Constants

pi, e

Brackets

( <expression> )

Logic-valued expression

( <logic expression> ) ? <true value> : <false value>

Logic operators

=, <>, <, >, <=, >=, !, &, |,

Examples

Basic Mathematics

The following example simply calculates the value of a fraction.

Numerator: {number-data:Numerator|decimal=true}1{number-data}
Denominator: {number-data:Denominator|decimal=true}2{number-data}
Result: {report-eval:Result|format=#0.0}%data:Numerator%/%data:Denominator%{report-eval}
Percentage: {report-eval:Percentage|format=##0\%}round(%variable:Result% * 100){report-eval}
Result

Numerator:1


Denominator:2
Result:0.5
Percentage:5000%

Cylinder Calculations

Calculate the properties of a cylinder based on its radius and height.

|| Radius | {number-data:Radius|decimal=true} cm ||
|| Height | {number-data:Height|decimal=true} cm ||
|| Base Circumference | {report-eval:Circumference} 2 * pi * %data:Radius%{report-eval} cm ||
|| Base Area | {report-eval:Base Area}pi * %data:Radius%^2{report-eval} cm ^2^ ||
|| Side Area | {report-eval:Side Area}%data:Height% * %variable:Circumference%{report-eval} cm ^2^ ||
|| Total Surface Area | {report-eval}%variable:Side Area% + %variable:Base Area% * 2{report-eval} cm ^2^ ||
|| Total Volume | {report-eval}%variable:Base Area% * %data:Height%{report-eval} cm ^3^ ||
Result

Radius


10

cm


Height


30

cm


Base Circumference


62.83185307179586

cm


Base Area


314.1592653589793

cm 2


Side Area


1884.9555921538758

cm 2


Total Surface Area


2513.2741228718346

cm 2


Total Volume


9424.77796076938

cm 3


Tutorial Examples