Special formatting for displaying HTML. This option will remove all inline styles defined in HTML and inserts styles defined in the editor.
NB! If you wish to render HTML with inline styles, please use the Text formatting.
NB! Renders content in monospace
using font size 11
.
Expression language is PDF Generator API specific programming language that allows to write mathematical and logical expression to manipulate the value displayed by component.
{% 2 + {dataFieldName} + {dataFieldName2}*0.5 %}
1. Arithmetic Operators
matches
(regex match) e.g {% {dataField} matches "/bar/" ? "yes" : "no" %}
{% {financial_status} === 'paid' ? 'All paid' : 'Waiting for payment' %}
{% {financial_status} === 'paid' ? uppercase({financial_status}) : 'Waiting for payment' %}
To display data field value in uppercase, use following expression.
{% uppercase({dataFieldName}) %}
To display data field value in lowercase, use following expression.
{% lowercase({dataFieldName}) %}
Uppercase the first character of each word in a string.
{% capitalize({dataFieldName}) %}
Example: {% capitalize('hello word') %}
=> Hello Word
It is possible to calculate sum of table column using following code
{% sum({line_items::amount}) %}
The sumproduct
function multiplies the corresponding items in the arrays and returns the sum of the results.
{% sumproduct({line_items::amount},{line_items::price}, {line_items::anotherColumn}) %}
It is possible to calculate average of table column using following code
{% avg({line_items::amount}) %}
It is possible to count number of items in list
{% count({line_items}) > 3 ? 'More than three' : 'Less than three' %}
The empty
function checks if field has value.
{% empty({dataField}) ? 'No value' : 'Field has value' %}
The join(delimiter, array)
function concatenates field values with specified separator. Last arguments is always used as the separator.
{% join(";", {field1}, {field2}, {field3}, ..., {fieldN}) %}
The split(delimiter, string)
function allows to split string into an array
{% split("_", "Some_string") %}
=> ["Some", "string"]
Format date value. NB! You need to use the Date formatter.
{% date({dateString}, {timezone}, {addDays}, {outputFormat}, {inputFormat}) %}
Examples:
Display current time - {% date('now') %}
Specify timezone - {% date({dateValue}, 'UTC') %}
Specify output format - {% datetime({dateValue}, 'UTC', 0, 'd/m/Y') %}
Specify output and input format - {% datetime({dateValue}, 'UTC', 0, 'd/m/Y', 'm/d/Y') %}
Format | Description | Example |
---|---|---|
Day | ||
d | Day of the month, 2 digits with leading zeros | 01 to 31 |
D | A textual representation of a day, three letters | Mon through Sun |
j | Day of the month without leading zeros | 1 to 31 |
l | A full textual representation of the day of the week | Sunday through Saturday |
Month | ||
F | A full textual representation of a month, such as January or March | January through December |
m | Numeric representation of a month, with leading zeros | 01 through 12 |
M | A short textual representation of a month, three letters | Jan through Dec |
n | Numeric representation of a month, without leading zeros | 1 through 12 |
Year | ||
Y | A full numeric representation of a year, 4 digits | Examples: 1999 or 2003 |
y | A two digit representation of a year | Examples: 99 or 03 |
Timezone | ||
O | Difference to Greenwich time (GMT) in hours | Example: +0200 |
P | Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3) | Example: +02:00 |
T | Timezone abbreviation | Examples: EST, MDT ... |
Z | Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. | -43200 through 50400 |
Format datetime value. NB! You need to use the Date formatter.
{% datetime({datetimeString}, {timezone}, {addDays}, {outputFormat}, {outputFormat}) %}
Examples:
Display current time - {% datetime('now') %}
Specify timezone - {% datetime({dateValue}, 'UTC') %}
Specify output format - {% datetime({dateValue}, 'UTC', 0, 'd/m/Y H:i:s') %}
Format | Description | Example |
---|---|---|
Time | ||
a | Lowercase Ante meridiem and Post meridiem | am or pm |
A | Uppercase Ante meridiem and Post meridiem | AM or PM |
G | 24-hour format of an hour without leading zeros | 0 through 23 |
h | 12-hour format of an hour with leading zeros | 01 through 12 |
H | 24-hour format of an hour with leading zeros | 00 through 23 |
i | Minutes with leading zeros | 00 to 59 |
s | Seconds with leading zeros | 00 through 59 |
Returns maximum value of list of elements or separate field values.
{% max({line_items::quantity}) %}
or {% max({dataField1}, {dataField2}, ..., {dataFieldN}) %}
Returns minimum value of list of elements or separate field values.
{% min({line_items::quantity}) %}
or {% min({dataField1}, {dataField2}, ..., {dataFieldN}) %}
Returns the rounded value to specified precision.
{% round({value}, 2) %}
Examples:
{% round(10.123, 2) %} // 10.12
Returns the next highest integer value by rounding up value if necessary.
{% ceil({value}) %}
Examples:
{% ceil(10.3) %} // 11
Returns the next lowest integer value by rounding down value if necessary,
{% floor({value}) %}
Examples:
{% ceil(10.3) %} // 10
Returns base raised to the power of exp.
{% pow({base}, {exp}) %}
Examples:
{% pow(2, 3) %} // 8
Returns the square root of value.
{% sqrt({value}) %}
Examples:
{% sqrt(4) %} // 2
Iterates over list of elements and executes expression for each element. Returns new list.
{% iterate({line_items}, 'quantity*price') %}
Iterates over list of elements and executes expression for each element. Returns new list.
{% iterate({line_items}, 'quantity*price') %}
Collects unique values from and counts them. Returns new list with following structure: [{"value": "Value", "count": 3, "raw_value": "Value"}, {"value": "Value 2", "count": 1, "raw_value": "Value 2"}]
{% collect_unique_values({array}, {array_of_values_to_exclude}, {expression_to_execute_for_each_item}) %}
Filters a list of elements by executing the given expression for each element. Returns new list.
{% filter({line_items}, 'price > 10.1') %}
Collects unique values from and counts them. Returns new list with following structure: [{"value": "Value", "count": 3, "raw_value": "Value"}, {"value": "Value 2", "count": 1, "raw_value": "Value 2"}]
{% collect_unique_values({array}, {array_of_values_to_exclude}, {expression_to_execute_for_each_item}) %}
Flattens list.
{% flatten(iterate({orders}, "{line_items}")) %}
Decode JSON string to use in an expression.
{% json_decode('{"key": "value"}', true) %}
AR Demo account
demo.example@actualreports.com