Conditional Merge Field Statements
Overview
Conditional merge field statements provide a way to check the value of a merge field to determine the display of information.
They are synonymous with ‘if’ statements in other coding languages.
Conditional Merge Field Statements in Actionstep Help Center
Applications
Returning different information based on whether a contact is an individual or a company
Leaving sections of a document blank if certain criteria is/is not met
Changing sections or leaving them blank when fields do not return a value
Customizing wording based on criteria
Any other application that may change as the result of a condition
Elements & Syntax
Elements
IF qualifier – The initial condition. The field checks this value and condition to return a True or False value. The text/field after the initial IF qualifier returns if the condition is True.
ELSE – Returns a value if the initial IF condition is False.
ELSEIF qualifier – Adds additional qualifiers with specific values returned if the ELSEIF condition is True.
ENDIF – Terminates the IF statement. No data is evaluated for the conditional merge field after this point.
Syntax example
[[*IF {FullName|pt=Client} == "Steve Rogers" *]] Mr. Rogers [[*ELSEIF {FullName|pt=Client} == "Tony Stark”*]] Mr. Stark [[*ELSE*]] Sir [[*ENDIF*]]
Plain text: If the full name of the client is Steve Rogers, return a ‘True’ value. If the value is ‘True,’ display ‘Mr. Rogers. Else if the full name of the client is Tony Stark, display “Mr. Stark.” If neither the IF or IFELSE are true, display the value after ELSE. Stop checking conditions at ENDIF.
Common Conventions
Individual or Company
[[*IF {i_c|c1=A|c2=B|pt=Client} == "A" *]] [[FullName|pt=Client]], [[CompanyName|pt=Client]] [[*ELSE*]][[CompanyName|pt=Client]][[*ENDIF*]]
“i_c” uses two options, c1 and c2. C1 is the value if the client is an individual. C2 is the value if the client is a company. The assigned values are checked by the IF qualifier. If the value is A (an individual), the Full Name and Company Name is displayed. If the IF value is B ( ELSE - a company), just the Company Name is displayed.
Record count
[[*IF {system_RecordCount|datasource=bill_expenses} > "0"*]]
[[*REPEAT|data_source=bill_expenses|tablerow|group_and_sum=T|*]]
[[BillExpenses_Title|ifnull=ignore|rn=*]]
[[*REPEAT|END*]]
[[*ELSE*]]
No expenses for this bill
[[*ENDIF*]]
System.RecordCount returns the number of records for the designated data source. In this example, it checks the number expenses for a bill. If the number is greater than zero, it displays a repeat block of expense titles. Otherwise (ELSE), it displays “No expenses for this bill.”
Delete Table Row
[[*IF {FullName|pt=Referrer} = "" *]]
[[*DELETEROW*]]
[[*ENDIF*]]
DELETEROW removes a table row from a word document. In the example: If there is no referrer the table row that contains the merge field is deleted. This is useful to remove sections of a document, based on certain criteria.