Logical computed column functions¶
This section provides syntax and examples for the logical computed column functions you can use with the Data Prep Compute tool. Use the logical functions to evaluate logical functions on column values. The new column contains TRUE
or FALSE
depending on the function results.
AND¶
Evaluates whether all arguments within an expression evaluate to TRUE
. If the arguments do evaluate to TRUE
, the value TRUE
is returned.
Syntax
AND(ARGUMENT_1, [ARGUMENT_2, ...])
ARGUMENT_1
is the argument to evaluate.ARGUMENT_2
, ... [optional] are the additional arguments.
Example
AND(@Column_A@, @Column_B@, @Column_C@)
Notes on use
The ARGUMENT
s you provide must be either a TRUE
or FALSE
value, a column that contains either value, or a function that returns either value.
The AND
function is case insensitive, so it treats True
, TRUE
, and true
the same way. Similarly, False
, FALSE
, and false
are treated the same.
IF¶
Allows you to specify a different output depending on whether or not a given statement is true.
Syntax
IF(CONDITION, TRUE_VALUE, FALSE_VALUE)
CONDITION
is the expression you want to evaluate.TRUE_VALUE
is the value the function returns if theCONDITION
is true.FALSE_VALUE
is the value that is returned if theCONDITION
is not true.
Example
IF(@Current Employer@ = 0, "N/A", @Current Employer@)
Notes on use
The IF
function is ideal in cases where a set of values need to be created based on information in one or more other columns.
The CONDITION
must provide either a TRUE
or FALSE
value. Other functions can be incorporated as part of the CONDITION
. Another IF
function can be used as one or both of the values. This allows for very fine-grained control over the returned value. In most cases, the CONDITION
will include an operator, see the Comparison operators () section of this article.
IFERROR¶
Allows you to specify a different output depending on whether or not a given statement is true.
Syntax
IFERROR(ARGUMENT, VALUE)
ARGUMENT
is the column you want to check.VALUE
is the value to return if the column cell contains an error.
Example
IFERROR(@New Column@, "N/A"
)
Notes on use
The VALUEs
you provide can be a text string or numeric value, a column that contains a text string or numeric value, or a function that returns a text string or numeric value.
For a cell where no error is found, the cell's original value is returned.
NOT¶
Reverses the result of an expression that results in a TRUE
or FALSE
value.
Syntax
NOT(ARGUMENT)
ARGUMENT
is the TRUE
or FALSE
value you want to reverse.
Example
NOT(@Column@)
Notes on use
The ARGUMENT
you provide must be either a TRUE
or FALSE
value, a column that contains either value, or a function that returns either value.
The NOT
function is case insensitive, so it treats True
, TRUE
, and true
the same way. Similarly, False
, FALSE
, and false
are treated the same.
OR¶
Determines if at least one value within an expression is TRUE
. If one value is TRUE
, the value TRUE
is returned.
Syntax
OR(ARGUMENT_1, [ARGUMENT_2, ...])
ARGUMENT_1
is the first argument you want to evaluate.ARGUMENT_2
, ... [optional] are the additional columns.
Example
OR(@Column_A@, @Column_B@, @Column_C@)
Notes on use
TheARGUMENT
s you provide must be either a TRUE
or FALSE
value, a column that contains either value, or a function that returns either value.
The OR
function is case insensitive, so it treats True
, TRUE
, and true
the same way. Similarly, False
, FALSE
, and false
are treated the same.