...
The else command will display the content between itself and {end} if none previous if or else if statements succeeded
Code Block |
---|
{end} |
The command to close the final the final statement statement
Code Block |
---|
!= {end} |
Tip |
---|
instead of `==`, you can use `!=` as the command "Does Not Equal". |
...
Code Block |
---|
{if($formField==yes)}
Congratulations, you were accepted
{else if($formField2==no)}
Sorry, try again
{else}
No result yet
{end} |
Comparing phrases with Space(s) in between
If you wish to compare phrases which contain spaces in between, be sure to wrap the phrase in ' '
or the condition will not work as expected
Examples
❌ {if($studentFirstName==John Doe)}
✔️ {if($studentFirstName=='John Doe')}
❌ {if($grade==Grade 5)}
✔️ {if($grade=='Grade 5')}
Chaining Multiple Conditions
You can chain multiple conditions by using the AND (&&) and OR (||) operators to create more complicated conditions.
Using AND (&&)
Note |
---|
There is currently an issue where creating a if statement that uses && breaks that statement. If you require && in your dynamic email setup, please notify the SchoolEngage team and we would be glad to touch up the email template so it works as expected. Issue: the editor converts Resolution: SchoolEngage team goes into the Custom Email Template file and change all instances of |
Code Block |
---|
{if(<field>==<value> && <field>==<value> &&...)} |
When chaining conditions with &&, every condition must be met to satisfy the if statement.
Using OR (||)
When chaining conditions with ||, at least one condition must be met to satisfy the if statement.
Full Example with Chained conditions
Code Block |
---|
{if($school==Apple Grove || $school==Cherry Hill)}
You've selected a School that is either Apple Grove or Cherry Hill!
{end}
{if(_grade!=10 && _grade!=11 && _grade!=12)}
The grade you've selected is grade 10 AND grade 11 AND grade 12
{else if($studentFirstName==John && _grade==9)}
Your student's first name is John AND you've selected grade 9.
{end} |
Testing your email templates
...