I'm new to Marketing Cloud and I'm trying to find a solution to what I think should be a pretty easy problem. I have an email template in which I would like to insert a date/time, which will be different for every subscriber(it is an appointment date for a reminder email). I have an 'Appointments' data extension where the date/time field is stored, along with the subscriber ID and I wondering the best way to access and display this data inline within my email template.
I looked at using the Lookup function in AMPScript to pull in the data I want, but I'm not sure if this is the best approach and I'm not quite sure of the syntax to make sure that data, once retrieved is displayed in my email.
EDIT: Here's my final code
<div style="display: none">%%[
var @rows, @row, @rowCount, @AppointmentDate
var @subscriberID
set @subscriberID = AttributeValue("subscriberid")
set @rows = LookupRows("Appointments","Contact ID", @subscriberID)
set @rowCount = rowcount(@rows)
if @rowCount > 0 then
set @row = row(@rows,1) /* get row #1 */
set @AppointmentDate = field(@row,"Date")
set @AppointmentDate = format(@AppointmentDate,"MM/dd/yyyy")
else
set @AppointmentDate = "not found"
endif
]%%
</div>
Your appointment date is: %%=v(@AppointmentDate )=%%