What happens in Example 1

The script used in this example creates a simple data table that you would incorporate into the body of a larger email. The code sample for Example 1 presents the contents of the script.

The following sections describe the actions the script performs and their result.

Identify the personalization fields required

Scripts must always start by declaring the personalization fields that it references. The names attribute of the <declarePF> tag lists the display names of the personalization fields used in the script.

You identify personalization fields defined from base tables using their display name. You identify personalization fields that map to dimension table fields in the following format.

<dimension table name>.<personalization field display name>

This example maps to fields in the CustTransact dimension table.

Greeting

The script includes a greeting that includes the customer's first name, specified with a personalization field. You can accomplish the same result using a personalization field in the Deliver Message Editor, but the example includes it here as an illustration of how to represent a personalization field in a script.

Data table

In this example, the @list tag sorts through the CustTransaction dimension table row by row. The data table intended for the email is created as part of the @list tag. The resulting list of transactions appears in descending order, so that the most recent transaction appears at the top of the list.

The table displays fields in each row of the CustTransaction table. Since, for this example, the dimension table lists only completed transactions, there is no need to check for null values.

Conditional statement

This example contains a simple conditional statement. It does not illustrate nested conditional content.

The script includes an @if tag to test for customer purchases. For each transaction that is a purchase, the script displays a statement next to the transaction date indicating the number of points awarded. Notice that if the transaction is not a purchase (the condition is false) the sentence does not appear.

Identifying note for Example 1

After the closing <scriptBody> tag the script includes a short descriptive statement. When you open an HTML document that contains this script or open the document in the Deliver Message Editor, this statement is the only text that appears.

This statement appears as a means to identify the presence of the script and its location within the email template.

Identify the personalization fields required

Scripts must always start by declaring the personalization fields that it references. The names attribute of the <declarePF> tag lists the display names of the personalization fields used in the script.

You identify personalization fields defined from base tables using their display name. You identify personalization fields that map to dimension table fields in the following format.

<dimension table name>.<personalization field display name>

This example maps to fields in the CustTransact dimension table.