0

Right now I have this AMPScript which displays the First Name of the email recipient.

%%[
var @fname
set @fname = [FirstName]
]%%

%%[ var @fname set @fname = [FirstName] ]%% Dear %%[IF not empty(@fname) THEN]%%%%=v(@fname)=%%%%[ELSE]%%Member%%[ENDIF]%%

Since my data extension includes a primary key which is not email address. One email can be in multiple rows with a different name. How can I make sure ampscript does not pickup an older record where name is different but recipient email is same? In my case, I want ampscript to display first name from the record where @EmailSend_Status == false. How can I do that?

1 Answer 1

3

You can do this using the LookupRows- or Lookup-function and using the email address and the sendstatus as where condition parameters. The lookup function works if you only want to retrieve the value of one column. If you need to use data from multiple columns, you need to use LookupRows

LookupRows example:

%%[
    Var @Row
    Set @Row = LookupRows("YourDataExtensionName", "EmailAddress", @VariableContainingEmailAddress, "EmailSend_Status", "True")
]%%

Lookup example:

%%[
    Var @fname
    Set @fname = LookupRows("YourDataExtensionName", "FirstName", "EmailAddress", @VariableContainingEmailAddress, "EmailSend_Status", "True")
]%%

Documentation:

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .