Add an if statement to a Merge Template

Add an if statement to optionally show information based on field data in your Merge Template.

An "if" statement can be used for any field type but is most commonly used with field types that take a single choice between two or more options.

In ProjectTeam.com, examples include checkboxes and picklists. You can output different information based on your choice by using "if" and "elseif" statements.

Additionally, "if" statements should always be used in formulas that have division in them. This is to avoid a "divide by zero" case which will cause your merge result to end in an error:

Checkbox example

The default language for a checkbox in a merged output is "Yes" for checked and "No" for unchecked. However, you can change this by using an if statement.

For example, if you wanted to change the language from Yes to "Closed" and No to "Not yet completed", you could use this:

  • {if $projectteam_0001 == 'Yes'}Closed{else}Not yet completed{/if}
Example Tag
Shown in multiple lines

{if $projectteam_0001 == 'Yes'}

Closed

{else}

Not yet completed

{/if}

Shown in a single line

{if $projectteam_0001 == 'Yes'}Closed{else}Not yet completed{/if}


Picklist example

A picklist field may have more than two possible answers and in that case, you will need to use a combination of if and elseif statements.

For example, if you had a picklist with three possible answers (Arch, Mech, Civ) but wanted to spell each out in your merged output, you could use this:

  • {if $projectteam_0001 == 'Arch'}Architectural information{elseif $projectteam_0001 == 'Mech'}Mechanical information{else}Civil information{/if}
Example Tag
Shown in multiple lines

{if $projectteam_0001 == 'Arch'}

Architectural information

{elseif $projectteam_0001 == 'Mech'}

Mechanical information

{else}

Civil information

{/if}

Shown in a single line {if $projectteam_0001 == 'Arch'}Architectural information{elseif $projectteam_0001 == 'Mech'}Mechanical information{else}Civil information{/if}

Division Formula example

Help text coming soon. 

 

Read more about if/else statements on the Smarty website.