IF
- Last UpdatedMar 03, 2025
- 2 minute read
The IF() function produces a stream based on the results of a logical expression.
Syntax
|
Format |
Stream = IF( LogicalExpression, TrueStream, FalseStream ) |
|
Arguments |
LogicalExpression - A logical expression to be evaluated TrueStream - A stream of values from which to select when the expression evaluates to TRUE FalseStream - A stream of values from which to select when the expression evaluates to FALSE |
|
Description |
When the LogicalExpression evaluates to a true value, the corresponding value from TrueStream is selected for the output stream. Otherwise, the corresponding value from the FalseStream is selected. |
|
Format |
Stream = IF( LogicalExpression, TrueStream ) |
|
Arguments |
LogicalExpression - A logical expression to be evaluated TrueStream - A stream of values from which to select when the expression evaluates to TRUE |
|
Description |
When the LogicalExpression evaluates to a true value, the corresponding value from TrueStream is selected for the output stream. Otherwise, a NULL or "bad quality" value is selected. |
|
Format |
Stream = IF( LogicalExpression ) |
|
Arguments |
LogicalExpression - A logical expression to be evaluated |
|
Description |
Produces an output stream of Boolean values representing the results of LogicalExpression. |
Example 1
The following expression returns the flow rate of a pump, but any negative values are replaced with 0.
IF(PLPReactor.PLPWIN2019.PR1_Storage.ProdLevel < 3000, 0, PLPReactor.PLPWIN2019.PR1_Storage.ProdLevel ):


Example 2
The following expression returns 1 when system CPU usage exceeds 90%, otherwise it returns 0.
IF( SysPerfCPUTotal > 90, 1, 0 )
Example 3
The following expression returns 1 when system CPU usage exceeds 90%, otherwise it returns a NULL value.
IF( SysPerfCPUTotal > 90, 1 )
Example 4
The following expression returns a true value (1) when system CPU usage exceeds 90%, otherwise it returns a false value (0).
IF( SysPerfCPUTotal > 90 )