When are if statements used?

{% if %} statements are used when you want to send different content based on certain criteria.

Example 1: You want to send Text A to a student who has submitted an enquiry regarding interested in coming to an Open Day (link to the event booking page and information about events), Text B to a student who wants to Enrol (link to the application page and information about enrolment), Text C to a student wanting a prospectus (link to prospectus) and Text D all other students with different choices.

Example 2: You want to send Text A to a student booking into an Information Evening event (location 1), Text B to a student booking into an Open day (location 2) and Text C to all other event types (general booking confirmation).

Example 3: You want to send Text A to a student with interview type Scholarship Interview, you want to send Text B to a student with interview type Learning Needs, you want to send Text C to a student with interview type Interview (normal) and Text D to a student with interview type Uniform Appointment.

Example 4: You want to send Text A to a student commencing in ELC, Text B to everyone in Kindergarten - Year 6 and Text C to everyone in year 7 - year 12.

The final email might look like this:

Dear Mrs Test and Dr Blimp

This is a friendly reminder that the interview for Robert is tomorrow. You and your son will be meeting with Allusha Strand.

Please meet at reception and remember to bring any additional support documentation for your interview.

Yours sincerely,

Mark Barrett

Step 2. Open the logic by adding if to the mergetag

{% if TAG == “xxx” %}

{% if TAG == number %}

Example 1: {% if enquiry.questions_str == “Open Day” %}

Example 2: {% if event.kind_label == “Information Evening” %}

Example 3: {% if interview_booking.interviewer.interview_type == “Scholarship Interview” %}

Example 4: {% if profile.entry_grade == 1 %}

  • Copy the tag from the brackets
  • Add the {% if in front of the tag
  • Make sure that the spacing is correct before the tag
  • Insert tag
  • Add == 7 (numbers) or ==”xxx” (text)
  • Make sure the text (xxx) matches exactly what is in EnrolHQ. Capital letters and spacing MUST be the same)
  • Make sure that the spacing is correct after the tag
  • Add the %} after the tag

Step 1. Finding the mergetag

Go to the mergetag inserter (please note that there are separate tag inserters for the email subject line and the main details) and find the correct tag. In the example above you would find the “enquiry - I would like to know more about” tag, the “event type” tag, the “interview type” tag and the "entry grade" tag.

{{ enquiry.questions_str }}

{{ event.kind_label }}

{{ interview_booking.interviewer.interview_type }}

{{ profile.entry_grade }}

Step 3. Add elif logic for multiple options

For the remaining alternatives you should insert elif logic. This will search through the options from top to bottom and print the top criteria that the student matches.

If the student is assigned to interview type Interview, the system will know he/she is not assigned to Scholarship Interview and move on to check the next, Learning Needs. When the system knows he/she is not assigned to Learning Needs it moves on to check the next tag. When the system finds a match with interview type Interview it will print the text that belongs to this section.

{% if TAG == “xxx” %}

{% elif TAG == “xxx” %}

{% elif TAG == “xxx” %}

{% elif TAG == “xxx” %}

Example:

{% if interview_booking.interviewer.interview_type == “Scholarship Interview” %}

{% elif interview_booking.interviewer.interview_type == “Learning Needs” %}

{% elif interview_booking.interviewer.interview_type == “Interview” %}

{% elif interview_booking.interviewer.interview_type == “Uniform Appointment” %}

Step 4: Add your text behind the logic

For each of your alternatives, add the text you want to differentiate. You can leave the text that is general above or below the logic (such as general greeting or kind regards)

Example:

Dear {{ first_parent.title }} {{ first_parent.last_name }} {% if second_parent.last_name %} and {{ second_parent.title }} {{ second_parent.last_name }}{% endif %}

This is a friendly reminder that the interview for {{ profile.first_name }} is tomorrow. You and your {{ profile.gender }} will be meeting with {{ interview_booking.interviewer.name }}.

{% if interview_booking.interviewer.interview_type == “Scholarship Interview” %} Please meet at classroom 8 for your Scholarship Interview

{% elif interview_booking.interviewer.interview_type == “Learning Needs” %} Please meet at reception and remember to bring any additional support documentation for your interview

{% elif interview_booking.interviewer.interview_type == “Interview” %} Please click on the link to start your interview

{% elif interview_booking.interviewer.interview_type == “Uniform Appointment” %} Please meet at reception for your Uniform Appointment

{% endif %}

Yours sincerely,

{{ school.settings.registrar_name }}

{{ school.settings.telephone }}

{{ school.settings.email }}

Step 5: Add {% else %} logic

For other alternatives than the ones that need to be specified or for students that don't meet these criteria, you can create a general response using {% else %} logic. When the system scans the if and elif statements and finds a student that doesn’t belong to any of these it will print the {% else %} statement.

Example:

{% if interview_booking.interviewer.interview_type == “Scholarship Interview” %} Please meet at classroom 8 for your Scholarship Interview

{% elif interview_booking.interviewer.interview_type == “Learning Needs” %} Please meet at reception and remember to bring any additional support documentation for your interview

{% elif interview_booking.interviewer.interview_type == “Interview” %} Please click on the link to start your interview

{% elif interview_booking.interviewer.interview_type == “Uniform Appointment” %} Please meet at reception for your Uniform Appointment

{% else %} Please meet at reception 10 minutes prior to your appointment.

Step 6: Close the logic with {% endif %}

You need to close the if logic using {% endif %} at the end. The logic will not work without this statement.

Example:

Dear {{ first_parent.title }} {{ first_parent.last_name }} {% if second_parent.last_name %} and {{ second_parent.title }} {{ second_parent.last_name }}{% endif %}

This is a friendly reminder that the interview for {{ profile.first_name }} is tomorrow. You and your {{ profile.gender }} will be meeting with {{ interview_booking.interviewer.name }}.

{% if interview_booking.interviewer.interview_type == “Scholarship Interview” %} Please meet at classroom 8 for your Scholarship Interview

{% elif interview_booking.interviewer.interview_type == “Learning Needs” %} Please meet at reception and remember to bring any additional support documentation for your interview

{% elif interview_booking.interviewer.interview_type == “Interview” %} Please click on the link to start your interview

{% elif interview_booking.interviewer.interview_type == “Uniform Appointment” %} Please meet at reception for your Uniform Appointment

{% else %} Please meet at reception 10 minutes prior to your appointment.

{% endif %}

Yours sincerely,

{{ school.settings.registrar_name }}

{{ school.settings.telephone }}

{{ school.settings.email }}