Rules/Expression Editor
ICONICS' Rules and Expression Engine in the GENESIS64 HMI/SCADA Suite has undergone major enhancements including:
This topic lists the rules/expressions that can be used within GENESIS64:
sin Function
Description:
Returns the sine of the specified angle
Parameters:
Parameter1: An angle, measured in radians
Returns:
A double precision floating point value
cos Function
Description:
Returns the cosine of the specified angle
Parameters:
Parameter1: An angle, measured in radians
Returns:
A double precision floating point value
tan Function
Description:
Returns the tangent of the specified angle
Parameters:
Parameter1: An angle, measured in radians
Returns:
A double precision floating point value
asin Function
Description:
Returns the angle whose sine is the specified number
Parameters:
Parameter1: A number representing a sine, where Parameter1 must be greater than or equal to -1, but less than or equal to 1.
Returns:
A double precision floating point value. An angle, measured in radians
acos Function
Description:
Returns the angle whose cosine is the specified number
Parameters:
Parameter1: A number representing a cosine, where Parameter1 must be greater than or equal to -1, but less than or equal to 1.
Returns:
A double precision floating point value. An angle, measured in radians
atan Function
Description:
Returns the angle whose tangent is the specified number
Parameters:
Parameter1: A number representing a cosine, where Parameter1 must be greater than or equal to -1, but less than or equal to 1.
Returns:
A double precision floating point value. An angle, measured in radians
sqrt Function
Description:
Returns the square root of a specified number.
Parameters:
Parameter1: A number
Returns:
A double precision floating point value. If Parameter1 is greater than or equal to zero, returns the square root. If Parameter1 is less than zero, returns not-a-number (NaN).
pow Function
Description:
Returns a number raised to a power
Parameters:
Parameter1: The number to be raised to a power
Parameter2: A power
Returns:
A double precision floating point value. Parameter1 raised to the power of Parameter2
log Function
Description:
Returns the logarithm of a specified number in a specified base
Parameters:
Parameter1: A number whose logarithm is to be found
Parameter2: The base of the logarithm
Returns:
A double precision floating point value. The logarithm of Parameter1 in the base Parameter2
ln Function
Description:
Returns the natural (base e) logarithm of a specified number
Parameters:
Parameter1: A number whose logarithm is to be found
Returns:
A double precision floating point value. The natural logarithm of Parameter1
exp Function
Description:
Returns e (natural logarithmic base constant) raised to the specified power
Parameters:
Parameter1: A number specifying a power
Returns:
The number e raised to the power of Parameter1
Remarks:
exp is the inverse of log
abs Function
Description:
Returns the absolute value of a specified number
Parameters:
Parameter1: A number
Returns:
A number that is greater than or equal to zero
ceil Function
Description:
Returns the smallest whole number that is greater than or equal to the specified number
Parameters:
Parameter1: A number
Returns:
The smallest whole number that is greater than or equal to Parameter1
floor Function
Description:
Returns the largest whole number less than or equal to the specified number
Parameters:
Parameter1: A number
Returns:
The largest whole number less than or equal to Parameter1
round Function
Description:
Rounds a value to the nearest integer
Parameters:
Parameter1: A number to be rounded
Returns:
The whole number nearest to Parameter1
roundto Function
Description:
Rounds a value to the specified number of decimal places
Parameters:
Parameter1: A number to be rounded
Parameter2: The number of decimal places in the return value
Returns:
The number nearest to Parameter1 that contains a number of fractional digits equal to Parameter2
min Function
Description:
Returns the smaller of two numbers
Parameters:
Parameter1: The first of two numbers to compare
Parameter2: The second of two numbers to compare
Returns:
The smaller of Paramter1 and Parameter2
max Function
Description:
Returns the larger of two numbers
Parameters:
Parameter1: The first of two numbers to compare
Parameter2: The second of two numbers to compare
Returns:
The larger of Paramter1 and Parameter2
IF THEN ELSE Conditional Branch
Description:
Returns the result of the THEN or ELSE branch depending on the value of the IF condition
Parameters:
Parameter1 (IF): A Boolean condition
Parameter2 (THEN): The value to return if Parameter1 is true
Parameter2 (ELSE): The value to return if Parameter1 is false
Returns:
Returns the result of the THEN or ELSE branch depending on the value of the IF condition
Remarks:
If the quality of Parameter1 is bad, the ELSE branch will be evaluated and returned
Example usage:
IF ({{tagname}} > 100)
THEN "high"
ELSE "low"
if Function
Description:
Conditionally returns the result of Parameter2 or Parameter3 depending on the value of Parameter1
Parameters:
Parameter1 (if): A Boolean condition
Parameter2 (then): The value to return if Parameter1 is true
Parameter2 (else): The value to return if Parameter1 is false
Returns:
Returns the result of Parameter2 or Parameter3 depending on the value of Parameter1
Remarks:
If the quality of Parameter1 is bad, Parameter3 will be returned
shl Function
Description:
Shifts the bits of the specified integer value to the left by the specified number of positions
Parameters:
Parameter1: A number for which to shift the bits
Parameter2: The number of positions by which to shift the bits
Returns:
The shifted number (an integer)
shr Function
Description:
Shifts the bits of the specified integer value to the right by the specified number of positions
Parameters:
Parameter1: A number for which to shift the bits
Parameter2: The number of positions by which to shift the bits
Returns:
The shifted number (an integer)
bittest Function
Description:
Tests if the bit at the specified position in the specified number is equal to 1
Parameters:
Parameter1: The number in which to test a bit
Parameter2: The zero-based index (from the right) of the bit to test
Returns:
True if the bit at the position specified by Parameter2 in the value specified by Parameter1 is 1
quality Function
Description:
Gets the quality of the specified value
Parameters:
Parameter1: a sub-expression, typically a variable (i.e. a tagname) for which to get the quality
Returns:
A quality value where 0 = Bad, 64 = Uncertain, and 192 = Good
setvalue Function
Description:
Assigns a value to a variable
Parameters:
Parameter1: a variable (i.e. a tagname)
Parameter2: a value to write to the variable
Returns:
A boolean. True if setvalue successfully initiated, False if setvalue failed (ex. trying to write to a readonly tag)
Remarks:
setvalue will be asynchronous for OPC tags, so ultimately a write to an OPC tag could fail after this function has already returned.
tostring Function
Description:
Converts the specified value to a string using culture-independent formatting
Parameters:
Parameter1: A value to convert to a string
Returns:
A string
tostringculture Function
Description:
Converts the specified value to a string using the current Operating System culture for formatting
Parameters:
Parameter1: A value to convert to a string
Returns:
A string
toformat Function
Description:
Converts the specified value to an explicitly formatted string using culture-independent format information
Parameters:
Parameter1: A value to convert to a string
Parameter2: A string designating the format for the returned string.
Returns:
A string
Remarks:
The format string for Parameter2 can be:
“D” : Integer with minimum number of digits required
“D#” : Integer with at least # digits (ex. D3 for a three digit integer)
“N” : Number (including digit grouping) with default number of decimal places (defined by culture formatting)
“N#” : Number (including digit grouping) with # number of decimal places (ex. N3 for three decimal places)
“F” : Number (without digit grouping) with default number of decimal places (defined by culture formatting)
“F#” : Number (without digit grouping) with # number of decimal places (ex. F3 for three decimal places)
“E” : Exponential notation with default number of decimal places (6 decimal places)
“E#” : Exponential notation with # number of decimal places (ex. E3 for three decimal places)
“G” : Number (equivalent of F or E, whichever produces the most compact string)
“G#” : Number (equivalent of F# or E#, whichever produces the most compact string)
“X” : Hexadecimal number with minimum number of digits required
“X#” : Hexadecimal with at least # digits (ex. X3 for a three digit hex number)
“P” : Number multiplied by 100 and displayed with a percent symbol
“P#” : Number multiplied by 100 and displayed with a percent symbol with # number of decimal places
“C” : A currency value
“C#” : A currency value with # number of decimal places
“R” : A string that can round-trip back to an identical number
toformatculture Function
Description:
Converts the specified value to an explicitly formatted string using the current Operating System culture for additional format information
Parameters:
Parameter1: A value to convert to a string
Parameter2: A string designating the format for the returned string.
Returns:
A string
Remarks:
The format string for Parameter2 can be:
“D” : Integer with minimum number of digits required
“D#” : Integer with at least # digits (ex. D3 for a three digit integer)
“N” : Number (including digit grouping) with default number of decimal places (defined by culture formatting)
“N#” : Number (including digit grouping) with # number of decimal places (ex. N3 for three decimal places)
“F” : Number (without digit grouping) with default number of decimal places (defined by culture formatting)
“F#” : Number (without digit grouping) with # number of decimal places (ex. F3 for three decimal places)
“E” : Exponential notation with default number of decimal places (6 decimal places)
“E#” : Exponential notation with # number of decimal places (ex. E3 for three decimal places)
“G” : Number (equivalent of F or E, whichever produces the most compact string)
“G#” : Number (equivalent of F# or E#, whichever produces the most compact string)
“X” : Hexadecimal number with minimum number of digits required
“X#” : Hexadecimal with at least # digits (ex. X3 for a three digit hex number)
“P” : Number multiplied by 100 and displayed with a percent symbol
“P#” : Number multiplied by 100 and displayed with a percent symbol with # number of decimal places
“C” : A currency value
“C#” : A currency value with # number of decimal places
“R” : A string that can round-trip back to an identical number
tonumber Function
Description:
Converts the specified value to a number using culture-independent format information
Parameters:
Parameter1: The value to convert to a number
Returns:
A number
Remarks:
If possible this function will try to convert the value to an integer number. If the value cannot be converted to an integer, this function will try to convert the value to a double-precision floating point number.
tonumberculture Function
Description:
Converts the specified value to a number using the current Operating System culture for formatting
Parameters:
Parameter1: The value to convert to a number
Returns:
A number
Remarks:
If possible this function will try to convert the value to an integer number. If the value cannot be converted to an integer, this function will try to convert the value to a double-precision floating point number.
tonumberbase Function
Description:
Converts the specified value in a specified base to a number
Parameters:
Parameter1: The value to convert to a number
Parameter2: The base of Parameter1 (this value must be 2, 8, 10, or 16). For example, use 16 if Parameter1 is a string that represents a Hexadecimal number.
Returns:
A number
toboolean Function
Description:
Converts the specified value to a boolean using culture-independent format information
Parameters:
Parameter1: The value to convert to a boolean
Returns:
A boolean value
tobooleanculture Function
Description:
Converts the specified value to a boolean using the current Operating System culture for formatting
Parameters:
Parameter1: The value to convert to a boolean
Returns:
A boolean value
asciitochar Function
Description:
Converts the specified ascii value(s) to equivalent character(s)
Parameters:
Parameter1: A number representing one or more ascii values. Each byte in the number represents one ascii character.
Returns:
A string containing one or more characters
asciitowchar Function
Description:
Converts the specified Unicode value(s) to equivalent Unicode character(s)
Parameters:
Parameter1: A number representing one or more Unicode values. Each 2 bytes in the number represents one Unicode character.
Returns:
A string containing one or more characters
chartoascii Function
Description:
Converts the specified character(s) to ascii value(s)
Parameters:
Parameter1: A string containing one or more characters. Each character in the string represents a 1 byte ascii value in the resulting number.
Returns:
An integer number
wchartoascii Function
Description:
Converts the specified Unicode character(s) to Unicode value(s)
Parameters:
Parameter1: A string containing one or more characters. Each character in the string represents a 2 byte Unicode value in the resulting number.
Returns:
An integer number
like Function
Description:
Performs a wildcard string search
Parameters:
Parameter1: The string in which to search
Parameter2: The pattern to search for in Parameter1
Parameter3: true to perform a case-sensitive search, false to ignore case
Returns:
True if Parameter2 is found in Parameter1.
Remarks:
Parameter2 may contain wildcards. Wildcard characters include:
? : Any single character
* : Zero or more characters
# : Any single digit (0-9)
[charlist] : Any single character in charlist
[!charlist] : Any single character not in charlist
To explicitly match these special wildcard characters as a literal character, enclose that character in square brackets. For example, to literally match an asterisk character (instead of a wildcard match), use [*]
len Function
Description:
Gets the length of a string
Parameters:
Parameter1: a string value
Returns:
The length of the string passed to Parameter1
substring Function
Description:
Extracts a portion of a string
Parameters:
Parameter1: A string from which to extract a substring
Parameter2: The zero-based index of the character in Parameter1 (starting from the left) at which to being the extraction
Parameter3: The length of the substring to extract
Returns:
The extracted substring
left Function
Description:
Returns the specified number of characters from the left side of a string
Parameters:
Parameter1: A string from which the leftmost characters are returned
Parameter2: The number of characters to return
Returns:
A string containing the specified number of characters from the left side of the input string
right Function
Description:
Returns the specified number of characters from the right side of a string
Parameters:
Parameter1: A string from which the rightmost characters are returned
Parameter2: The number of characters to return
Returns:
A string containing the specified number of characters from the right side of the input string
concat Function
Description:
Concatenates two strings together
Parameters:
Parameter1: The first string to concatenate
Parameter2: The second string to concatenate
Returns:
A string that is the result of appending Parameter2 to Parameter1
indexof Function
Description:
Returns the zero-based index of the first occurrence of a substring within a string
Parameters:
Parameter1: The string in which to search
Parameter2: The string to search for
Parameter3: The zero-based index at which to start searching in Parameter1
Returns:
The zero-based position of Parameter2 within Parameter1, or -1 if not found
replace Function
Description:
Search for text within a string and replaces all occurrences that text with a different substring
Parameters:
Parameter1: The string in which to search
Parameter2: The substring to search for
Parameter3: The text to insert in place of Parameter2
Returns:
A string equivalent to Parameter1 except that all instances Parameter2 are replaced with Parameter3
trim Function
Description:
Removes all leading and trailing occurrences of the specified set of characters from the specified string
Parameters:
Parameter1: The string from which to remove characters
Parameter2: A string where each character in the string belongs to the set of characters that will be trimmed. If this parameter is an empty string, all whitespace characters will be trimmed.
Returns:
The string that remains after all occurrences of the characters in Parameter2 are removed from the start and end of Parameter1.
Remarks:
Parameter2 represents a set of characters, not an exact string match
trimleft Function
Description:
Removes all leading occurrences of the specified set of characters from the specified string
Parameters:
Parameter1: The string from which to remove characters
Parameter2: A string where each character in the string belongs to the set of characters that will be trimmed. If this parameter is an empty string, all whitespace characters will be trimmed.
Returns:
The string that remains after all occurrences of the characters in Parameter2 are removed from the start of Parameter1.
Remarks:
Parameter2 represents a set of characters, not an exact string match
trimright Function
Description:
Removes all trailing occurrences of the specified set of characters from the specified string
Parameters:
Parameter1: The string from which to remove characters
Parameter2: A string where each character in the string belongs to the set of characters that will be trimmed. If this parameter is an empty string, all whitespace characters will be trimmed.
Returns:
The string that remains after all occurrences of the characters in Parameter2 are removed from the end of Parameter1.
Remarks:
Parameter2 represents a set of characters, not an exact string match
tolower Function
Description:
Converts all of the characters in the specified string to lowercase
Parameters:
Parameter1: A string
Returns:
The input string with all characters converted to lowercase
toupper Function
Description:
Converts all of the characters in the specified string to uppercase
Parameters:
Parameter1: A string
Returns:
The input string with all characters converted to uppercase
todatetime Function
Description:
Converts the specified value to a DateTime using culture-independent format information
Parameters:
Parameter1: The value to convert to a DateTime
Returns:
A DateTime value
Remarks:
If Parameter1 is a string, it should be in the following format:
[YYYY-MM-DD] [hh:mm[:ss][Z] [AM|PM]] (elements in square brackets are optional)
YYYY : year
MM : month
DD : day
hh : hours
mm : minutes
ss : seconds
Z : designates UTC time
AM or PM : include when using 12-hour clock time
The DateTime string representation may include date-only, time-only, or date and time.
Example Usage:
“2011-05-31 07:34:42 PM”
“2011-05-31 19:34:42”
“2011-05-31”
todatetimeculture Function
Description:
Converts the specified value to a DateTime using the current Operating System culture for formatting
Parameters:
Parameter1: The value to convert to a DateTime
Returns:
A DateTime value
Remarks:
If Parameter1 is a string, it should be in the following format:
[YYYY-MM-DD] [hh:mm[:ss][Z] [AM|PM]] (elements in square brackets are optional)
YYYY : year
MM : month
DD : day
hh : hours
mm : minutes
ss : seconds
Z : designates UTC time
AM or PM : include when using 12-hour clock time
The DateTime string representation may include date-only, time-only, or date and time.
Example Usage:
“2011-05-31 07:34:42 PM”
“2011-05-31 19:34:42”
“2011-05-31”
totimespan Function
Description:
Converts the specified value to a TimeSpan using culture-independent format information
Parameters:
Parameter1: The value to convert to a TimeSpan
Returns:
A TimeSpan value
Remarks:
If Parameter1 is a number, it is interpreted to be the total milliseconds of the TimeSpan. If Parameter1 is a string, it should be in the following format:
[-][d.]hh:mm[:ss[.ff]] (elements in square brackets are optional)
- : optional minus sign indicates a negative timespan
d : optional number of days
hh : hours (0 to 23)
mm : minutes (0 to 59)
ss : optional seconds (0 to 59)
ff : optional fractional seconds
Example Usage:
“1.05:30” = 1 day, 5 hours, 30 minutes
“4:10.05” = 4 hours, 10 minutes, 5 seconds
“00:00.10” = 10 seconds
totimespanculture Function
Description:
Converts the specified value to a TimeSpan using the current Operating System culture for formatting
Parameters:
Parameter1: The value to convert to a TimeSpan
Returns:
A TimeSpan value
Remarks:
If Parameter1 is a number, it is interpreted to be the total milliseconds of the TimeSpan. If Parameter1 is a string, it should be in the following format:
[-][d.]hh:mm[:ss[.ff]] (elements in square brackets are optional)
- : optional minus sign indicates a negative timespan
d : optional number of days
hh : hours (0 to 23)
mm : minutes (0 to 59)
ss : optional seconds (0 to 59)
ff : optional fractional seconds
Example Usage:
“1.05:30” = 1 day, 5 hours, 30 minutes
“4:10.05” = 4 hours, 10 minutes, 5 seconds
“00:00.10” = 10 seconds
frommilliseconds Function
Description:
Returns a TimeSpan from the specified number of milliseconds
Parameters:
Parameter1: The number of milliseconds to convert to a TimeSpan
Returns:
A TimeSpan representing the specified number of milliseconds
fromseconds Function
Description:
Returns a TimeSpan from the specified number of seconds
Parameters:
Parameter1: The number of seconds to convert to a TimeSpan
Returns:
A TimeSpan representing the specified number of seconds
fromminutes Function
Description:
Returns a TimeSpan from the specified number of minutes
Parameters:
Parameter1: The number of minutes to convert to a TimeSpan
Returns:
A TimeSpan representing the specified number of minutes
fromhours Function
Description:
Returns a TimeSpan from the specified number of hours
Parameters:
Parameter1: The number of hours to convert to a TimeSpan
Returns:
A TimeSpan representing the specified number of hours
fromdays Function
Description:
Returns a TimeSpan from the specified number of days
Parameters:
Parameter1: The number of days to convert to a TimeSpan
Returns:
A TimeSpan representing the specified number of days
totalmilliseconds Function
Description:
Returns the total number of milliseconds for the specified TimeSpan
Parameters:
Parameter1: A TimeSpan
Returns:
The total number of milliseconds in the specified TimeSpan
totalseconds Function
Description:
Returns the total number of seconds for the specified TimeSpan
Parameters:
Parameter1: A TimeSpan
Returns:
The total number of seconds in the specified TimeSpan
totalminutes Function
Description:
Returns the total number of minutes for the specified TimeSpan
Parameters:
Parameter1: A TimeSpan
Returns:
The total number of minutes in the specified TimeSpan
totalhours Function
Description:
Returns the total number of hours for the specified TimeSpan
Parameters:
Parameter1: A TimeSpan
Returns:
The total number of hours in the specified TimeSpan
totaldays Function
Description:
Returns the total number of days for the specified TimeSpan
Parameters:
Parameter1: A TimeSpan
Returns:
The total number of days in the specified TimeSpan
timesincelastchange Function
Description:
Returns the elapsed time since a value last changed
Parameters:
Parameter1: a sub-expression, typically a variable (i.e. a tagname)
Parameter2: a deltaValue (deadband) - Parameter1 must change by more than this amount to be considered a change
Parameter3: a TimeSpan or a number (milliseconds) - periodically recalculates the expression (in case the variable specified in Parameter1 is not changing, this refresh is needed to update the elapsed time)
Returns:
A TimeSpan or a number (milliseconds). The return type is determined by the type of value passed to parameter3
Example usage:
timesincelastchange({{tagname}}, 0, "0:00:10")
or
timesincelastchange({{tagname}}, 10, 30000)
trueforduration Function
Description:
Returns true if a boolean condition has been true for a specified amount of time (or longer)
Parameters:
Parameter1: a sub-expression that evaluates to a boolean condition
Parameter2: a TimeSpan duration that specifies how long Parameter1 must be true before this function will return true
Returns:
A Boolean. True if Parameter1 has been true for the amount of time specified in Parameter2 (or longer), false otherwise.
Example usage:
trueforduration({{tagname}} > 100, 5000)
or
trueforduration({{tagname}} > 100, "0:00:05")
or
trueforduration({{tagname}} > 100, fromseconds(5))
now Function
Description:
Returns the current local date and time at the moment this expression is evaluated
Parameters:
None
Returns:
The current local date and time at the moment this expression is evaluated
utcnow Function
Description:
Returns the current UTC date and time (Coordinated Universal Time) at the moment this expression is evaluated
Parameters:
None
Returns:
The current UTC date and time at the moment this expression is evaluated
pi Constant
Description:
Represents the ratio of the circumference of a circle to its diameter
e Constant
Description:
Represents the natural logarithmic base
true Constant
Description:
Boolean constant for a true condition
false Constant
Description:
Boolean constant for a false condition
< Operator
Description:
Determines whether or not one value is less than another value
Operands:
Operand1: The first value to compare
Operand2: The second value to compare
Result:
True if Parameter1 is less than Parameter2, false otherwise
Remarks:
If the data types of the two parameters are different, the parameters will both be converted to numbers for comparison. If the data types of the two parameters are the same, the parameters will be compared directly without any type conversion. This operator can be used to compare numbers, strings, DateTimes, and TimeSpans.
> Operator
Description:
Determines whether or not one value is greater than another value
Operands:
Operand1: The first value to compare
Operand2: The second value to compare
Result:
True if Parameter1 is greater than Parameter2, false otherwise
Remarks:
If the data types of the two parameters are different, the parameters will both be converted to numbers for comparison. If the data types of the two parameters are the same, the parameters will be compared directly without any type conversion. This operator can be used to compare numbers, strings, DateTimes, and TimeSpans.
<= Operator
Description:
Determines whether or not one value is less than or equal to another value
Operands:
Operand1: The first value to compare
Operand2: The second value to compare
Result:
True if Parameter1 is less than or equal to Parameter2, false otherwise
Remarks:
If the data types of the two parameters are different, the parameters will both be converted to numbers for comparison. If the data types of the two parameters are the same, the parameters will be compared directly without any type conversion. This operator can be used to compare numbers, strings, DateTimes, and TimeSpans.
>= Operator
Description:
Determines whether or not one value is greater than or equal to another value
Operands:
Operand1: The first value to compare
Operand2: The second value to compare
Result:
True if Parameter1 is greater than or equal to Parameter2, false otherwise
Remarks:
If the data types of the two parameters are different, the parameters will both be converted to numbers for comparison. If the data types of the two parameters are the same, the parameters will be compared directly without any type conversion. This operator can be used to compare numbers, strings, DateTimes, and TimeSpans.
== Operator
Description:
Determines whether or not one value is equal to another value
Operands:
Operand1: The first value to compare
Operand2: The second value to compare
Result:
True if Parameter1 is equal to Parameter2, false otherwise
Remarks:
If the data types of the two parameters are different, the parameters will both be converted to numbers for comparison. If the data types of the two parameters are the same, the parameters will be compared directly without any type conversion. This operator can be used to compare numbers, strings, DateTimes, and TimeSpans.
!= Operator
Description:
Determines whether or not one value is not equal to another value
Operands:
Operand1: The first value to compare
Operand2: The second value to compare
Result:
True if Parameter1 is not equal to Parameter2, false otherwise
Remarks:
If the data types of the two parameters are different, the parameters will both be converted to numbers for comparison. If the data types of the two parameters are the same, the parameters will be compared directly without any type conversion. This operator can be used to compare numbers, strings, DateTimes, and TimeSpans.
&& Operator
Description:
Returns true if both operands are true
Operands:
Operand1: The first Boolean value to logically combine
Operand2: The second Boolean value to logically combine
Result:
Returns true if both operands are true
Remarks:
Operands are automatically converted to Boolean if they are not already boolean
|| Operator
Description:
Returns true if either of the two operands are true
Operands:
Operand1: The first Boolean value to logically combine
Operand2: The second Boolean value to logically combine
Result:
Returns true if either of the two operands are true
Remarks:
Operands are automatically converted to Boolean if they are not already boolean
! Operator
Description:
Returns the logical inverse of the specified operand
Operands:
Operand1: The Boolean value to invert
Result:
If Operand1 is true, the result is false. If Operand1 is false, the result is true.
Remarks:
The operand is automatically converted to Boolean if it is not already a Boolean value
& Operator
Description:
The bitwise AND operator compares each bit of the first operand to the corresponding bit of the second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.
Operands:
Operand1: The first value to combine
Operand2: The second value to combine
Result:
The bitwise AND combination of the two operands
Remarks:
Operands are automatically converted to integers if they are not already integers
| Operator
Description:
The bitwise OR operator compares each bit of the first operand to the corresponding bit of the second operand. If either bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.
Operands:
Operand1: The first value to combine
Operand2: The second value to combine
Result:
The bitwise OR combination of the two operands
Remarks:
Operands are automatically converted to integers if they are not already integers
~ Operator
Description:
The bitwise NOT operator inverts each bit in a value. Any 1 becomes a 0 and any 0 becomes a 1.
Operands:
Operand1: The value for which to invert bits
Result:
The bitwise NOT of the operand
Remarks:
The operand is automatically converted to an integer if it is not already an integer
^ Operator
Description:
The bitwise XOR (exclusive OR) operator compares each bit of the first operand to the corresponding bit of the second operand. If only one of the bits is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.
Operands:
Operand1: The first value to combine
Operand2: The second value to combine
Result:
The bitwise XOR combination of the two operands
Remarks:
Operands are automatically converted to integers if they are not already integers
+ Operator
Description:
Adds one value to another value
Operands:
Operand1: The first value
Operand2: The value to add to Operand1
Result:
The addition of Operand2 to Operand1
Remarks:
If both operands are strings, this operator will perform a string concatenation. If the first operand is a DateTime and the second operand is TimeSpan, the result will be a DateTime. If both operands are TimeSpans, the result will be a TimeSpan. Otherwise, the operands will be added as numbers.
- Operator
Description:
Subtracts one value from another value
Operands:
Operand1: The first value
Operand2: The value to subtract from Operand1
Result:
The subtraction of Operand2 from Operand1
Remarks:
If the first operand is a DateTime and the second operand is TimeSpan, the result will be a DateTime. If both operands are DateTimes, the result will be a TimeSpan. If both operands are TimeSpans, the result will be a TimeSpan. Otherwise, the operands will be subtracted as numbers.
* Operator
Description:
Multiplies one value by another value
Operands:
Operand1: The first value
Operand2: The value to multiply Operand1 by
Result:
The multiplication of Operand1 by Operand2
Remarks:
Operands are automatically converted to numbers if they are not already numbers
/ Operator
Description:
Divides one value by another value
Operands:
Operand1: The first value
Operand2: The value to divide Operand1 by
Result:
The division of Operand1 by Operand2
Remarks:
Operands are automatically converted to numbers if they are not already numbers
% Operator
Description:
Divides one value by another value and returns the remainder
Operands:
Operand1: The first value
Operand2: The value to divide Operand1 by
Result:
The remainder of the division of Operand1 by Operand2
Remarks:
Operands are automatically converted to numbers if they are not already numbers
( Open Parenthesis
Description:
The open parenthesis operator is used to designate the start of a group of operations. Operators have implicit priorities that determine the sequence in which they are evaluated (which does not necessarily match the order in which the operators are used in an expression). Grouping with parentheses can be used to override this implicit precedence of operations.
The default precedence of operations is:
/, *, %, -, +, !=, ==, >=, <=, >, <, ~, &, |, ^, !, &&, ||, functions, IF
) Close Parenthesis
Description:
The close parenthesis operator is used to designate the end of a group of operations. Operators have implicit priorities that determine the sequence in which they are evaluated (which does not necessarily match the order in which the operators are used in an expression). Grouping with parentheses can be used to override this implicit precedence of operations.
The default precedence of operations is:
/, *, %, -, +, !=, ==, >=, <=, >, <, ~, &, |, ^, !, &&, ||, functions, IF
0x Constant Prefix
Description:
A number following this prefix will be interpreted as a Hexadecimal constant
0t Constant Prefix
Description:
A number following this prefix will be interpreted as a Octal constant
0b Constant Prefix
Description:
A number following this prefix will be interpreted as a Binary constant
“ Constant String Delimiter
Description:
Text surrounded by double quotes is interpreted as a constant string
$“ Begin Escaped Constant String Delimiter
Description:
Place this delimiter at the beginning of a constant string for which the string will also contain literal double quote characters.
Example Usage:
$”This is a “string” containing double quotes”$
“$ End Escaped Constant String Delimiter
Description:
Place this delimiter at the end of a constant string for which the string will also contain literal double quote characters.
Example Usage:
$”This is a “string” containing double quotes”$
<< Begin Alias/Parameter Delimiter
Description:
Parameters or aliases are placeholders that are resolved to “actual” values before the expression is evaluated. Typically this is used to provide different variables/tags to an expression depending on the context.
Example Usage:
100 + {{<<parameter>>}}
>> End Alias/Parameter Delimiter
Description:
Parameters or aliases are placeholders that are resolved to “actual” values before the expression is evaluated. Typically this is used to provide different variables/tags to an expression depending on the context.
Example Usage:
100 + {{<<parameter>>}}
{{ Begin Variable Delimiter
Description:
Variables are named items in an expression that can change value during the lifetime of the expression. When the variable value changes, the expression result is recalculated. Typically variables represent live data such as OPC tags.
Example Usage:
100 + {{@sim64:Double.Ramp(5,0,100,0).Value}}
}} End Variable Delimiter
Description:
Variables are named items in an expression that can change value during the lifetime of the expression. When the variable value changes, the expression result is recalculated. Typically variables represent live data such as OPC tags.
Example Usage:
100 + {{@sim64:Double.Ramp(5,0,100,0).Value}}
See Also:
Expressions in the Data Browser