Conditions

The templating engine in Targetprocess supports conditional if / elseif / else statements, similar to conditional statements in many programming languages.

Conditions are helpful when you develop a process-specific, project-specific, or entity-specific notification.

To perform a basic conditional statement, use the following syntax:

#if(condition)
  this is included to email if condition is true 
#else
  this is included to email if condition is false
#end

In the #if statement, condition must resolve to a Boolean (true / false). You can pass a Boolean directly, or you can pass some operational condition.

Following is a list of available operators and symbols and examples of each.

OperatorSymbolAlternate SymbolExample
Equals==eq#if( $var == 12 )
#if( $var eq ‘hello’ )
Object Equivalence==eq#if( $var == $othervar )
Not Equals!=neq#if( $var != 12 )
#if( $var != ‘hello’ )
#if( $var != $othervar )
Greater Than (Numeric only)>gt#if( $var > 12 )
Less Than (Numeric only)<lt#if( $var < 12 )
Greater Than or Equal To (Numeric only)>=ge#if( $var >= 12 )
Less Than or Equal To (Numeric only)<=le#if( $var <= 12 )
Boolean Not!not#if( !$var )

When using conditionals in the single-line string, the else and end directives can be wrapped in brackets to help the engine delimit these directives. This is especially useful if text immediately follows the directives. For example:

Value is #if( $var >= 0 ) positive #{else} negative #{end}.