|
|
Documentation Wiki > ExactTarget > Content > AMPscript > Getting Started With AMPscript > AMPscript 101
AMPscript 101From $1Table of contentsThis scenario includes information on the following aspects of using AMPscript:
The AMPscriptThe entire AMPscript for this email is printed below: %%[ /* 101 */ Var @memid, @fname, @lname, @prefname, @address, @zip, @mempref, @plat Set @memid = MemberID Set @fname = FirstName Set @lname = LastName Set @prefname = PrefName Set @address = Address Set @zip = Zip Set @mempref = MemPref Set @plat = Plat /* 101 */ ]%%%%= v(@fname) =%%, below are your account details First Name:%%= v(@fname) =%%Last Name:%%= v(@lname) =%% Preferred Name:%%= v(@prefname) =%% Address Address:%%= v(@address) =%% Zip:%%= v(@zip) =%% Member Preferences Shopping Preference:%%= v(@mempref) =%% Platinum Member:%%= v(@plat) =%% Note how the first part of the AMPscript is set off with a code block declaration - %%[ and ]%% - because it spans over several lines (located between the "/* 101 */" comments). The subscriber does not see the results of these variables yet. The "Var" command creates the variables named in that line of code, each of which is separated by a comma. The "Set" commands give the variables the value of the information taken from a column in the data extension associated with the send. %%[ /* 101 */ Var @memid, @fname, @lname, @prefname, @address, @zip, @mempref, @plat Set @memid = MemberID Set @fname = FirstName Set @lname = LastName Set @prefname = PrefName Set @address = Address Set @zip = Zip Set @mempref = MemPref Set @plat = Plat /* 101 */ ]%%
The AMPscript within the email's text is set off with inline code declarations - %%= and =%% - because the AMPscript refers to a variable that belongs to a single line of text within the email. In the email, information from the data extension associated with the email send replaces the AMPscript declarations. %%= v(@fname) =%%, below are your account details First Name:%%= v(@fname) =%%Last Name:%%= v(@lname) =%% Preferred Name:%%= v(@prefname) =%% Address Address:%%= v(@address) =%% Zip:%%= v(@zip) =%% Member Preferences Shopping Preference:%%= v(@mempref) =%% Platinum Member:%%= v(@plat) =%% The email itself begins with the following template: From here, you cut-and-paste the AMPscript into a content area, as shown below:
Note the text version of the same email as well:
To test your email with the data extension you'll use for the actual send, click Send Preview and select the data extension from your available send options, as shown in the figure below:
Choose a test recipient to start your preview with and click the Generate Preview button. You'll see the information the AMPscript has pulled from the data extension placed into the email, as shown below:
Click the arrow keys in the top-right section of the screen to cycle through the other rows in the data extension. You'll see the fields change depending on the row selected. Once you're satisfied with the information, you can send the email job. Each email you send will be populated with information from the row associated with that subscriber. This page was last updated by Ryan Williams on Tue, 16 Aug 2011 13:10:26 GMT. If you require assistance with the ExactTarget application, please contact Global Support. If you wish to send Ryan direct feedback, fill out the form below:
Tags: (Edit tags)
|
Powered by MindTouch 2010 |