Expression Evaluator¶
Function
Calculates the result of an expression with integers, decimals, numeric variables, string variables (only for string comparisons), arithmetic and Boolean operators and a set of functions.
Properties
Properties |
Description |
---|---|
Expression |
Expression to be calculated. Note if the expression does not follow the correct syntax, the converter will not perform the calculation. |
Mode |
|
Source
One or more variables, identified by a placeholder with an index number, with the following format {index}
. The index number is progressive, must be an integer greater than zero ({0}
).
The placeholders can appear in any order in the expression.
Valid literal values
Boolean:
true
andfalse
.Integers
Decimals. The decimal separator must be a point.
Hexadecimal numbers with prefix “0x” (e.g.
0xff
)Text, delimited by double quotation marks (e.g.
string
)Note
double quotation marks repeated twice (
""
) are interpreted as an escape sequence.
Valid Operators
Arithmetical:
+
, `` -`` ,*
, `` /`` ,%
and unary operator-
Bitwise:
&
,|
,^
,``~``Shift:
<<
,>>
Logics:
&&
,||
,!
Unary casting of
(<data_type>)
typeComparison
<
,<=
,>
,>=
,==
,!=
Note
all the comparison operators are applicable both to numeric data, and to DateTime and Duration data.
Note
the operators:
==
and!=
are also applicable to String and LocalizedText data types.
Datatype Conventions
Literal integers are Int32.
Decimal literals are Double.
Numerical values are considered to be Int32.
The following literals:
true
andfalse
are interpreted as Boolean.The
/
operator always returns a Double value.The
%
operator generates an exception when there is division by modulo zero.The
%
operator accepts Float and Double operands.All the functions return a Double value except for the
sign
function, which returns an Int32 value.The unary casting operator accepts the following datatypes:
bool, Boolean
sbyte, SByte
short, Int16
int, Int32
long, Int64
byte, Byte
ushort, UInt16
uint, UInt32
ulong, UInt64
float, Single
double, Double
Parentheses
The expression can contain an unlimited number of parentheses, correctly opened and closed.
Available Functions
These mathematical functions are available:
Function |
Calculated value |
Example |
---|---|---|
|
Maximum of two values |
|
|
Minimum of two values |
|
|
Average of given values |
|
|
Absolute value |
|
|
Integer part of a decimal number |
|
|
Approximated value by excess |
|
|
Approximated value by defect |
|
|
Approximation to the nearest integer |
|
|
Square root |
|
|
0 if the argument value is greater than zero 1 if the argument value is less than zero |
|
Output
The resulting value of the expression.
Logical representation
The following image illustrates an example of a logical conversion in the advanced dynamic link editor.