 |
Dynamic Content for Dymamic Customer Interaction
One of the most powereful features of Campaign Enterprise is its ability to effectively pesonalize messages. Not only are there the standard merge field options, which allow you to personlaize small sections of the subject line, email addresses, or in the message body, large blocks of text, images, or other information stored in the database, or even in separate files can be pulled into the message dynamically.
How the case statement works
Case statements offer much more flexibility than the immediate if statements. If the field in the example above listed more organization types, you can use that information to send out even more dynamic information to each organization using the same email campaign.
Sample Table
|
emailaddress |
firstname |
lastname |
orgtype | |
bigbusiness@company.com |
Jerry |
Macaroni |
0 | |
smallbusiness@smco.com |
Cheryl |
Montana |
2 |
nodough@nonprofit.org
|
Stephen |
Munson |
1 |
How to set up a Case Statement
The Case Statement uses the following syntax:
{CASE WHEN condition THEN response WHEN condition THEN response WHEN condition THEN response ELSE THEN response END}
- Condition: this is the value found in the field "occupation". You can use the following operands to compare fields in your database; = (equals), > (greater than), >= (greater than or equal to), < (less than), <= (less than or equal to, <> (not equal to). The field may be a numeric, or character field. When comparing character strings you are limited to = and < >.
- Response: this is the string that is placed in the message if the corresponding condition is true. This can be a text string or value, or another field in your database, or a path to a message file.
- ELSE THEN: if none of the conditions specified are true, then you can enter a default text string or value, or another field in your database, or a path to a default type of message.
Examples:
Case Statement that Returns a String:
{CASE WHEN OrgType=1 THEN "yes, you are eligible for a discount." WHEN OrgType=2 THEN "small businesses may or may not be eligible, please call." ELSE THEN "sorry, you make too much money to get the discount." END}
In this case if the ID in any of the records in your database is equal to 1 the string "yes, you are eligible for a discount" will appear in the email message. If the OrgType is equal to 2, the string "small businesses may or may not be eligible, please call." will appear in the message. In all other cases, the string "sorry, you make too much money to get the discount." will appear in the message.
"Dear Stephen, yes, you are eligible for a discount."
"Dear Cheryl, small businesses may or may not be eligible, please call."
"Dear Jerry, sorry, you make too much money to get the discount."
Case Statement that Returns a Field from the Database:
{CASE WHEN OrgType=1 THEN "{Field1}" WHEN OrgType=2 THEN "{Field2}" ELSE THEN "{Field3}" END}
Field1 and Field2 are additional fields stored in your database table. In this case if the OrgType in any of the records is equal to 1 the value in the table for the field named Field1 will appear in the message. If the ID is equal to 2 then the value in the table for the field named Field2 will appear. In all other cases, the value in Field3 will appear in the message.
"Dear Stephen, the discount is 15%."
"Dear Cheryl, the discount is 10%."
"Dear Jerry, sorry, you still make too much money to get the discount."
Case Statement that Returns a File:
{CASE WHEN OrgType=1 THEN "{FILE:C:\messagefolder\OrgType1textfile.txt}" WHEN OrgType=2 THEN "{FILE:C:\messagefolder\OrgType2textfile.txt}" ELSE THEN "{FILE:C:\messagefolder\default.txt}" END}
In this case if the OrgType in any of the records in your database is equal to 1 then message contained in OrgType1textfile.txt will appear in the message. If the OrgType is 2 the OrgType2textfile.txt will appear. In all other cases, the OrgType2textfile.txt will appear in the message. Using this method you can change whole paragraphs on the fly or send entirely different messages to the people on your list.
It is possible to use a combination of the above methods to dynamically compose your messages. The statement could return a field for one response, and a file for another response in whatever combination works best. For example:
{CASE WHEN OrgType=1 THEN "{FILE:C:\messagefolder\ID22textfile.txt}" WHEN OrgType=2 THEN "{Field2}" ELSE THEN "sorry, you make too much money to get the discount." END}
Different constraints can also be used in the same Case Statement, for example:
{CASE WHEN OrgType=1 THEN "{FILE:C:\messagefolder\OrgType22textfile.txt}" WHEN Name=Cheryl THEN {Field1} ELSE THEN "sorry, you make too much money to get the discount." END}
Keep in mind that if a record is true for both constraints, for example the OrgType equals 1 and the name does equal Cheryl, only the first constraint listed will merge into the message body. If you would like to place both types of information into the email message, you will need to use two different case statements. -- Arial Software
Return
to Articles |