Logic
Logic functions provide Boolean algebra and conditional testing capabilities to the In-Sight spreadsheet. All bitwise functions perform the corresponding logical operation on each bit position in the binary representation of the arguments and return the resulting binary number in decimal form. For example, bit 0 of Value0 is compared to bit 0 of Value1, bit 1 of Value0 is compared to bit 1 of Value1, etc. Bitwise functions are particularly useful with MultiStatus and Discrete I/O Functions, when combining the results of multiple true/false conditions into a GUI display or discrete output. For more information, see MultiStatus or Discrete I/O Functions.
| Operator | Symbol |
|---|---|
| NOT | ! |
| AND | && |
| OR | || |
| Equivalent to | == |
| Not equal to | <> (or !=) |
-
When certain snippets are inserted into the spreadsheet, the formula that appears in the Job Edit Toolbar may contain characters such as !, &&, ||, ==, <>, >=, <=, and !=.
-
The AND and && operators will function differently if an empty cell or a cell containing a string is present in the list of arguments.
For all Logic functions:
- FALSE = 0
- TRUE = any non-zero result
|
Function |
Description |
|---|---|
|
And(Value1, Value2, ...) |
Returns 1 if all values are non-zero.
(Logical AND Note:
|
|
BitAnd(Value1, Value2, ...) |
Returns the bitwise AND of values. Note: Processes only
the lower 16 bits.
|
|
BitNot(Value) |
Returns the bitwise inverse of Value. Note: Processes only
the lower 16 bits.
|
|
BitOr(Value1, Value2, ...) |
Returns the bitwise OR of values. Note: Processes only
the lower 16 bits.
|
|
BitXor(Value1, Value2, ...) |
Returns the bitwise XOR (exclusive OR)
of Values. (Logical XOR Note: Processes only
the lower 16 bits.
|
|
If(Cond, Value1, Value2) |
Returns Value1 if Cond is non-zero; otherwise, returns Value2. Note: If the condition
or the arguments reference empty cells, they are interpreted as a zero
(FALSE).
|
|
InRange(Value, Start, End) |
Returns TRUE if Min(Start,End) ≤ Value ≤ Max(Start,End). |
|
Not(Value) |
Returns 0 if Value is non-zero, or 1 if Value is 0. (Logical Inverse) |
|
Or(Value1, Value2, ...) |
Returns 0 if all values are zero; otherwise,
returns 1. (Logical OR |
the result is TRUE when both values are TRUE.)