IsNull
Similar to the Empty function, this function provides a conditional evaluation of an expression. If the expression evaluates as null
, the function will output true
, otherwise it will output false
.
Argument
IsNull(1)
Ordinal | Type | Required | Description |
---|---|---|---|
1 | String | True | A variable or nested function to evaluate |
NOTE: This function only evaluates Data Extension field values. When used to evaluate other contexts, it will output
false
.
Example
In the following example, a form is displayed on a personalized landing page and the code conditionally displays a field.
%%[
var @phone
set @phone = Lookup("Members", "Phone", "Subscriber Key", _subscriberKey)
if IsNull(@phone) then
]%%
<label>Phone</label> <input type="text" name="phone">
%%[ endif ]%%
Output
If the Data Extension Phone
field does not contain a value for a Subscriber, the IsNull function will evaluate to true
and an input field will be displayed on the form.
<label>Phone</label> <input type="text" name="phone">