Iif()

Use the Iif() function to quickly test a condition. You pass the condition as the first parameter. The condition can be any function or expression that returns true or false. If the condition is true, the function returns the second parameter. If the condition is false, it returns the third parameter.

The Iif() function has three parameters:

  • condition (string): Required. The condition to test.
  • valueIfTrue (string): The value to return if the condition is true.
  • valueIfFalse (string): The value to return if the condition is false.

In this example, the function returns the value of the variable @Var if the variable isn’t empty, and returns "Hello" if the variable is empty.

This example constructs a greeting for a message using the Iif() and Concat() functions. It looks at the FirstName field in the subscriber profile for the recipient.

If the FirstName field in the subscriber profile contains a value, the Iif() function outputs a string that greets the subscriber by name.

If the FirstName field in the subscriber profile is empty, the Iif() function produces a generic text string.