|
|||||||||||||||
|
|||||||||||||||
IF Statements - Different Emails to Different PeopleUse conditional statements to send different email content to different recipients. To use it, click the "Insert IF block" button or choose Insert IF command under the Mail menu. This will bring up the Insert If helper, which will guide you through the process of creating the IF statement.
In the Field Name drop-down box, select the field name in the database field you will be comparing to. In the Comparison drop-down box, select the comparison you will be using. Then, in the Compare To field, type the text you will be comparing the field name to. If you would like for your search to be case-sensitive, then check Case sensitive. This means that a search for MARK will not return mark. Then, type the text or choose the field name to insert if the above condition is true. In the text field, you can also include a field name, surrounded with brackets like [this]. Here is a relatively simple IF statement: <%IF [Country] = "USA" THEN %>You're an American<% ELSE %>You're not an American <% END IF %>
This does a case-insensitive equality comparison of the field Country with the text USA, substituting "Youre an American" if Country does equal USA and substituting "Youre not an American" if Country does not equal USA. This is the same comparison, but if the comparison is not true, the country is displayed. The IF generator does not facilitate generation of complex statements such as these, so it is recommended that you create the basic structure with the IF generator and make the custom modifications in the editor. The goal of the following code is to correctly display a multi-line address; if there is no second address line, this if statement will not display it. [First Name] [Last Name] [Address1] <%IF NOT ISEMPTY [Address2] THEN %>[Address2]<% END IF %> [City], [State] [Zip Code] <%IF [Country] != "USA" THEN %>[Country] <%END IF%> The IF statements in Mailer are highlighted in blue to make them easier to read. The first IF checks and sees the [Address2] field is not blank. If it is not blank, then both the [Address1] and the [Address 2] fields are inserted. The second IF simply does not print the [Country] field if it equals USA. You can place IF statements anywhere: inside of other IF statements, inside of file attachment blocks, even in the message headers (the Subject, From, and Reply-to fields). Operators and Syntax
<%IF if-expression THEN %>output<%END IF%> <%IF if-expression THEN %>output1<% ELSE %>output2<% END IF %> Note that hard returns in your mailing inside of a conditional will get output to the mailing. So be careful where you place your carriage returns. You can put whitespace in a line if you need to like this: <%IF if-expression THEN |
|
Home |
Site map |
Analyzer |
Mailer |
PopMonger |
Resources |
Customers
and Partners |
Contact |