Expressions
Here, you’ll find a description of all operators, functions, and attributes that can be used in code expresions within Pertuniti.
This description covers all operators, functions, and attributes of objects that are available in expressions within document templates.
You may often need the descriptions of functions and object attributes.
Are clear overview of the actual creation of document templates is available here!
Literals
Literals are strings that directly represent fixed values in expressions, e.g. integers.
Literals can be combined (with variables) using operators. Also, they can be applied as arguments of functions.
Input |
Value Type |
Example |
[+/-]Number |
Type Double |
1337 |
[+/-][Number].Number |
Type Double |
-3.14 |
int(Double value) |
Type Integer |
int(42) |
'n Characters' |
Type String |
'Hello World' |
"n Characters" |
Type String |
"Hello World" |
\" |
Double quote |
"\"" |
\' |
Single quote |
"\'" |
\n |
New line |
"\n" |
\\ |
Backslash |
"\\" |
\else |
Applied w/o further interpretation |
"\pertuniti" = "pertuniti" |
True |
Type Boolean: True |
TRUE , true |
False |
Type Boolean: False |
FALSE , false |
Null |
Null |
NULL , null |
For strings, you do not need to escape the respective other quotation mark.
Non-string-literals are case-insensitive, i.e.
false
= FALSE
= FaLsE
.
Operators
Operator |
Semantics |
Numbers |
Arg
+
Arg
|
Addition |
Arg
-
Arg
|
Subtraction |
Arg
*
Arg
|
Multiplication |
Arg
/
Arg
|
Division |
Arg
<
Arg
|
Less |
Arg
<=
Arg
|
Less equal |
Arg
>
Arg
|
Greater than |
Arg
>=
Arg
|
Greater equal |
Arg
==
Arg
|
Equal |
Arg
!=
Arg
|
Unequal |
Boolean |
Arg
and
Arg
|
And |
Arg
or
Arg
|
Or |
! Arg
|
Negation |
Arg
==
Arg
|
Equal |
Arg
!=
Arg
|
Unequlal |
String |
Example |
Arg
+
Arg
|
Concatenation |
"a" + "b" = "ab" |
Arg
*
Arg
|
Multiplication |
"." * 3 = "..." |
Arg
and
Arg
|
Boolean and operation, false represented by "False" or "" , otherwise true |
"True" and false = false |
Arg
or
Arg
|
Boolean or operation, false represented by "False" or "" , otherwise true |
"True" or false = true |
Arg
==
Arg
|
Equal |
Arg
!=
Arg
|
Unequal |
Objects |
Object.Field
|
Access to attribute Field of the object Object |
Object[index]
|
Access to the list or array Object at the position index |
Arg
==
Arg
|
Equal |
Arg
!=
Arg
|
Unequal |
Functions
-
now()
Date
Current date (as java.util.Date
)
-
attr(
Object
,
Attribute
)
String | Date | Contact (Value)
If the passed Object
contains flexible attributes (e.g. case, event, task, document): Access to attribute Attribute
-
int(
String or number
)
Integer
Parse string or cast to integer
-
float(
String or number
)
Double
Parse string or parse to floating value (Double)
Attention: The expression language does not distinguish single or double precision floating values. Floating values (both types) are represented by the typical double
type of a JVM.
-
str(
String or object
)
String
Cast or format to string, or call toString() of the passed object.
-
len(
String or array or list
)
Integer
Length of the string, array, or list
-
dateformat(
Date
,
format
)
String
-
get(
Collection<T>
,
Position
)
T
Return the element at the position Position
of the collection Collection
(list, array)
-
sort(
Collection<T>
,
Sort attributes...
)
List<T>
Sort a collection (list, set). Without any sort attribute, the values or their string representations are compared (ascending). Sort attributes are applied by their order until they differ. Sort attributes can be applied ascending ("+attribut", "attribut") or descending ("-attribut"), and this mode may differ between attributes.
-
format(
format
,
arguments...
)
String
Formatting text, e.g. floating point precision, dates, ... similar to
printf
.
The function
format_US
applies a comma as decimal separator and a point for indicating the decimal place.
The function
format_DE
switches those, i.e. a dot as decimal separator and a comma for the decimal place ("Gleitkommazahl").
The function
format
is an alias for
format_US
.
Formatting is interpreted according to
https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html.
-
contact(
roles...
)
Contact
Retrieve first contact of the current case matching any passed role.
The selection is performed according to the order of passed roles.
If no contact with any of these roles is present in the case, the result is null
.
If more than one contact matches for the same role, the selection is random.
-
contacts_all()
Contact[]
contacts_all(
roles...
)
Contact[]
Retrieve all contacts of the current case matching at least one passed role.
Without an argument, all contacts of the current case are emitted.
Contacts matching more than one role are returned only once.
If no contact can be matched, the result is an array of length 0
.
-
address(
Contact
)
Adresse
address(
Contact
,
Preferences...
)
Adresse
If present, an address of the passed contact.
The selection is performed according to the order of passed preferences.
For example: address(recipient, 'WORK', 'HOME')
first checks addresses with the label WORK
. If there is none, it checks addresses labeled with HOME
. If no prefernence yields any address, the function just returns the first address stored within a contact.
-
email(
Contact
)
String
email(
Contact
,
Preferences...
)
String
If present, an email address of the passed contact.
The selection is performed according to the order of passed preferences.
-
fax(
Contact
)
Phone
fax(
Contact
,
Preferences...
)
Phone
If present, a phone number of type Private Fax, Work Fax, Other Fax.
The selection is performed according to the order of passed preferences.
-
phone(
Contact
)
Phone
phone(
Contact
,
Preferences...
)
Phone
If present, a phone number of type Mobile, iPhone, Private, Work, Headquarters.
The selection is performed according to the order of passed preferences.
-
just_mobile(
Contact
)
Phone
just_mobile(
Contact
,
Preferences...
)
Phone
If present, a phone number of type Mobile or iPhone.
The selection is performed according to the order of passed preferences.
Available Attributes
Our security model restricts access to attributes of objects that were not explicitly released.
The following tables determine the configured object types and currently available attributes.
Currently,
we only added attributes to the security model that were actually necessary for templates.
If you need further access to attributes that are captured within the application but not available in the respective table, contact johannes.tenschert@pertuniti.de.
Generally,
expressions can only access information that the performing user has access to,
i.e. document templates adhere to the rights management of your cases.
Case
Name |
Type |
Semantics |
Name |
String |
Case name |
Owner |
Contact |
Case owner |
Tasks |
Set |
Tasks of the case (not deleted) |
Name |
Type |
Semantics |
Prefix |
String |
Name prefix, e.g. "Dr." |
FirstName |
String |
First name |
MiddleName |
String |
Middle name(s) |
LastName |
String |
Last name |
Suffix |
String |
Name suffix, e.g. "M.B.A." |
Organization |
String |
Name of organization |
isOrganization |
Boolean |
True if contact represents organization |
Birthday |
Date |
Birthday |
Gender |
String |
Gender, within "MALE" , "FEMALE" , "OTHER" , "UNKNOWN" |
Address
Name |
Type |
Semantics |
POBox |
String |
PO Box |
Extension |
String |
Second address line |
Street |
String |
Street / number |
Locality |
String |
Location |
Region |
String |
Region |
Zipcode |
String |
Zip code |
Country |
String |
Country |
Phone
Name |
Type |
Semantics |
Number |
String |
Phone or fax number |
Type |
String |
Type of phone number, within "MOBILE" , "IPHONE" , "PRIVATE" , "WORK" , "HEADQUARTERS" , "FAX_PRIVATE" , "FAX_WORK" , "FAX_OTHER" , "PAGER" , "OTHER" |
Task
Name |
Type |
Semantics |
Id |
Integer |
Id of the task |
Description |
String |
Name of the task |
Status |
TaskStatus |
Current status of the task |
Assigned |
Contact |
Task assigned to (optional) |
Due |
Date |
Task due date (optional) |
Priority |
Integer |
Priority of the task (optional) |
Tags |
List |
List of assigned tags |
Order |
Integer |
Order in the list |
TaskStatus
Name |
Type |
Semantics |
Name |
String |
Unlocalized name of the status |
Type |
String |
Basic type of the status, within "NEEDS_ACTION" , "COMPLETED" , "IN_PROGRESS" , "CANCELLED" |