0 / 0
Logical functions

# Logical functions

The logical functions perform bit operations.

The logical functions are in the Logical category of the expression editor. Square brackets indicate an argument is optional. The examples show the function as it appears in a Derivation field in the Transformer stage.
BitAnd
Returns the bitwise AND of the two integer arguments.
• Input: number1 (uint64), number2 (uint64)
• Output: number (uint64)
• Examples. If mylink.mynumber1 contains the number 352 and mylink.mynumber2 contains the number 400, then the following two functions are equivalent, and return the value 256:
``````BitAnd(352,400)
``````
BitCompress
Returns the integer made from the string argument, which contains a binary representation of "1"s and "0"s.
• Input: string
• Output: number (uint64)
• Examples. If mylink.mynumber1 contains the string "0101100000", then the following two functions are equivalent, and return the number 352.
``````BitExpand("0101100000")
``````
BitExpand
Returns a string containing the binary representation in "1"s and "0"s of the given integer.
• Input: number (uint64)
• Output: string
• Examples. If mylink.mynumber1 contains the number 352, then the following two functions are equivalent, and return the string "0101100000".
``````BitExpand(352)
``````
BitOr
Returns the bitwise OR of the two integer arguments.
• Input: number1 (uint64), number2 (uint64)
• Output: number (uint64)
• Examples. If mylink.mynumber1 contains the number 352 and mylink.mynumber2 contains the number 400, then the following two functions are equivalent, and return the value 496:
``````BitOr(352,400)
``````
BitXOr
Returns the bitwise Exclusive OR of the two integer arguments.
• Input: number1 (uint64), number2 (uint64)
• Output: number (uint64)
• Examples. If mylink.mynumber1 contains the number 352 and mylink.mynumber2 contains the number 400, then the following two functions are equivalent, and return the value 240:
``````BitXOr(352,400)
``````
Not
Returns the complement of the logical value of an expression. If the value of expression is true, the Not function returns a value of false (0). If the value of expression is false, the NOT function returns a value of true (1). A numeric expression that evaluates to 0 is a logical value of false. A numeric expression that evaluates to anything else, other than the null value, is a logical true. An empty string is logically false. All other string expressions, including strings that include an empty string, spaces, or the number 0 and spaces, are logically true.
• Input: expression
• Output: complement (int8)
• Examples. If mylink.myexpression contains the expression 5–5, then the following two functions are equivalent, and return the value 1:
``````Not(5-5)

``````
If mylink.myexpression contains the expression 5+5, then the following two functions are equivalent, and return the value 0:
• ``````Not(5+5)
``````SetBit(356,"2,4,8",1)