If Statement

Overview

The "if" statement allows you to conditionally display content based on specific criteria. The statement begins with <c:if> and ends with </c:if>. Unlike traditional programming languages, statement conditions cannot be combined using && (AND) or || (OR). However, "if" statements can be nested inside one another.

Attributes

All attributes go inside the opening <c:if> tag, and must be surrounded by double-quotes.

value1 (required)

The first value to test against. value1 can be a string, number, boolean (True or False) or Data Object property.

value2 (required)

The second value to test against. value2 can be a string, number, boolean (True or False) or Data Object property.

operator (required)

The operator indicates the way in which you wish to compare value1 and value2. operator must be one of the following values:
  • < (Less than)
  • <= (Less than or equal to)
  • = or == (Equal to)
  • >= (Greater than or equal to)
  • > (Greater than)
  • != or <> (Not equal to)

Example

<c:if value1="[c:Account.Firstname]" operator="!=" value2="">
    <h3>[c:Account.Firstname]</h3>
</c:if>