Supported Data Types, Operators, and Statements
Primavera Cloud Expression Language is a lightweight scripting language optimized for security and performance within Oracle Primavera Cloud. Primavera Cloud Expression Language syntax is similar to popular programming languages such as Java, and includes additional syntax for working with data in Primavera Cloud.
Primavera Cloud Expression Language supports several data types, operators, and statements. Refer to the sections below for more information on Primavera Cloud Expression Language supported data types and programming constructs.
Data Types
The following table lists Primavera Cloud Expression language data types.
Supported Data Types
Type | Example |
---|---|
Boolean |
|
Date |
|
Double |
|
String |
|
Operators
Primavera Cloud Expression Language provides operators for computation and comparison. Operators can only be applied to data types they support. The following tables list Primavera Cloud Expression Language supported operators.
Supported Numeric Operators
Use numeric operators to perform calculations on numeric data types, such as doubles.
Operator | Name | Description | Applicable Data Types | Return Data Type | Example |
---|---|---|---|---|---|
+ | Addition | Sums two Double values. | Double | Double |
|
- | Subtraction | Subtracts two Double values. | Double | Double |
|
* | Multiplication | Multiplies two Double values. | Double | Double |
|
/ | Division | Divides two Double values. | Double | Double |
|
% | Modulo (remainder) | Returns the remainder resulting from the division of two Doubles. | Double | Double |
|
** | Exponential | Returns the result of raising one Double to the power of another. | Double | Double |
|
Unary - | Unary Minus | Indicates a negative value. | Double | Double |
|
Supported Logical Operators
Use logical operators to manipulate and combine Boolean values and to construct conditional statements.
Operator | Name | Description | Applicable Data Types | Return Data Type | Example |
---|---|---|---|---|---|
|| | OR | Returns the result of combining Boolean values using a logical OR. If one value or expression contained in the OR statement evaluates to true, the OR expression returns true. | Boolean | Boolean |
|
&& | AND | Returns the result of combining Boolean values using a logical AND. If both values or expressions in the AND statement evaluate to true, the AND expression returns true. | Boolean | Boolean |
|
! | NOT | Negates the specified Boolean value. Applying the NOT operator to an expression that evaluates to true will return false. | Boolean | Boolean |
|
Supported Comparison Operators
Use comparison operators to measure values against each other. The data types of compared values must match, otherwise the application will return an error. The result of a comparison operation is a Boolean, true or false.
Operator | Name | Description | Applicable Data Types | Return Data Type | Example |
---|---|---|---|---|---|
== | Equal | Tests if two values are equal. | All | Boolean |
|
!= | Does Not Equal | Tests if two values are not equal. | All | Boolean |
|
> | Greater Than | Tests if one value is greater than another. | All | Boolean |
|
>= | Greater Than or Equal To | Tests if one value is greater than or equal to another. | All | Boolean |
|
< | Less Than | Tests if one value is less than another. | All | Boolean |
|
<= | Less Than or Equal To | Tests if one value is less than or equal to another. | All | Boolean |
|
Supported Special Operators
Use special operators to create structure in your Primavera Cloud Expression Language code and specify how Primavera Cloud should interpret and run your Primavera Cloud Expression Language expressions.
Operator | Name | Description | Applicable Data Types | Example |
---|---|---|---|---|
+ | Concatenation | Combines a String with another data type, yielding a new String. String concatenation is applied when the leftmost operand of the + operator is of the data type String. The right operand can be a value of any type. When concatenated, Date values may not serialize in the format anticipated. | String |
|
= | Assignment | Assigns a value of a supported data type to a variable. | All |
|
( ) | Parentheses | Specifies logical grouping and evaluation order. Statements in parentheses have increased precedence. | All |
|
new | Constructor | Instantiates a new instance of a class, resulting in an object of that class. | Date |
|
// | Comment | Indicates a single-line comment. Commented lines are not evaluated. Use comments to describe and annotate your formula script. Comments extend to the end of a line. | All |
|
/**/ | Multi-line Comment | Indicates an extended comment. Multi-line comments are not evaluated. Multi-line comments may span multiple lines. | All |
|
Statements
Primavera Cloud Expression Language supports a variety of statements you can use to determine the control flow of Primavera Cloud Expression Language code. The following tables list Primavera Cloud Expression Language statements.
Supported Statements
Statement | Description | Example |
---|---|---|
def | Specifies a variable. Variables in Primavera Cloud Expression Language are strongly typed and restricted to the data type of their initial assignment. Variables are not accessible outside the scope of the code block they are declared in. Variables declared outside of code blocks or other control structures are global and may be accessed from anywhere within the script. |
|
return | Specifies a value that should be returned as the result of a script and serve as the default value of the configured field associated with the formula script. The return statement ends script processing. If no return statement is specified, Primavera Cloud Expression Language scripts automatically return the last statement evaluated. |
|
{ } (block) | Specifies a sequence of expressions to evaluate. Used to structure Primavera Cloud Expression Language scripts, establish variable scope, and improve readability. Variables defined and assigned values within a code block are accessible only within the code block and other structures the code block contains. |
|
if/else | Code contained in an if block will only be evaluated if the condition specified by the if statement evaluates to true. Code in the else block will be evaluated if the specified condition evaluates to false. |
|
Unsupported Programming Constructs
For improved efficiency and security, Primavera Cloud Expression Language does not support the following programming constructs:
- Loops (for example: for, for each, while).
- Function or method definition.
- Arrays, hashes, or collections.
- Mixed assignment operators (for example: ++, --, +=, -=).
- String interpolation.
- Regular expressions.
Note: The application generates a validation error if your Primavera Cloud Expression Language scripts contain unsupported data types or other unsupported control structures.
Last Published Tuesday, May 21, 2024