Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel

TSL IF statement [[[IF expr]]] [[[/IF]]]


The IF statement enables you to selectively perform tasks within your TSL message, based on some criteria which evaluate to TRUE or FALSE.


Syntax

Code Block
[[[IF expr]]] message [[[/IF]]]


Inputs

  • expr: is an expression that evaluates to TRUE or FALSE
  • message: is a TSL message, so it can contain plain text and other TSL conditions


Example

Suppose you want to create a welcoming message after a user has logged in to your application. Then you could create the following TSL message:

Code Block
Welcome [[[IF user.gender = 'male']]]Mr.[[[/IF]]] [[[IF user.gender = 'female']]]Mrs.[[[/IF]]] [[[user.first_name]]] [[[user.last_name]]]

When user John Doe logged on, the message shown in your application is: “Welcome Mr. John Doe”

When user Jane Doe logged on, the message shown in your application is: “Welcome Mrs. Jane Doe”

If the gender is unknown the message will look like this: “Welcome Jane Doe”

Back to top