Add an IF field to a quote template
This article describes how to use IF merge fields in Quote Templates.
IF fields test the value of the merge field, then display different results depending on whether the test result is true or false . The format of an IF field is:
{ IF [Test Condition] [Result Displayed if TRUE] [Result Displayed if FALSE] }
The result displayed can be text, the value of a merge field, a table, or nothing.
For example, the following IF field displays the text " FREE " if the value of Charge.EffectivePrice equals 0 . Otherwise, the IF field displays nothing.
{ IF {MERGEFIELD Charge.EffectivePrice \* MERGEFORMAT} = 0 "FREE" "" \* MERGEFORMAT }
{ IF }
IF fields are contained within curly braces. You must insert the curly braces into your invoice template by pressing Ctrl + F9 (or command + fn +F9 on a Mac). Do not manually type the curly braces.
{ IF {MERGEFIELD Charge.EffectivePrice \* MERGEFORMAT} }
If the merge field formatting appears different than shown above, you may be in the field result view. To toggle to the field code view, press Alt + F9 (or option + fn + F9 on a Mac).
Example 1: Display Text or a Merge Field Value
The IF field in this example tests the value of Charge.EffectivePrice for 0 . If the value equals 0 , the test returns true and the IF field displays "FREE" on the Quote. If the value of the field does not equal 0 , then the IF field displays the value of the merge field Charge.EffectivePrice on the quote.
{ IF { MERGEFIELD Charge.EffectivePrice } = 0 "FREE" {MERGEFIELD Charge.EffectivePrice \* MERGEFORMAT} }
Example 2: Display or Hide a Merge Field Value
The IF field in this example tests the value of Charge.Discount for 0 . If the value equals 0 , the test returns true , and the IF field does not display anything on the Quote. If the value of Charge.Discount does not equal 0 , the test returns false , and the IF field displays "You saved" followed by Charge.Discount .
{ IF {MERGEFIELD Charge.Discount} = 0 "" "You saved {MERGEFIELD Charge.Discount \# $#,##0.00}" }
The IF field displays nothing if the result is two consecutive double quotes ( "" ).