I have a master DE that has all my marketing database, within this DE each person has preferred store.

We are running a series of event based on their preferred store

I have almost no experience with AMPScript however understand i can use a AMPScript to reference a preferred store name from my master DE to pull data from a event data Ext matching on the preferred store in the event DE

My Preferred Store DE will has the following fields:

  • Preferred_Store
  • Branch_Name
  • EventLocation
  • Event Date
  • Event Time

My Master DE has:

  • First Name
  • Last Name
  • EMail
  • Mobile
  • Address
  • Preferred Store

I need the AMPScript to lookup preferred store name on the Master DE for a individual, and output the Event data.

We will need to output all fields into a table form the Event DE


In addition to the plethora of lookuprows() and lookuporderedrows() examples here on SFSE, here's an example from The AMPscript Guide:

var @rows, @row, @rowCount, @numRowsToReturn, @region, @i

set @region = AttributeValue("Region") /* value from attribute or DE column in send context */
set @region = "North" /* or a literal value */
set @rows = LookupRows("LoyaltyMembers","region", @region)
set @rowCount = rowcount(@rows)

output(concat("region: ", @region))

if @rowCount > 0 then
  for @i = 1 to @rowCount do

    var @emailAddress, @firstName, @rank
    set @row = row(@rows, @i) /* get row based on counter */
    set @firstName = field(@row,"firstName")
    set @emailAddress = field(@row,"emailAddress")


    <br>Row %%=v(@i)=%%, firstName: %%=v(@firstName)=%%, emailAddress: %%=v(@emailAddress)=%%


  next @i ]%%

%%[ else ]%%

No rows found

%%[ endif ]%%

I also have some variations here on my blog.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.