I have a data extension with the following fields:


I want to list these attributes in an email as rows using Ampscript, but I can't seem to figure it out. I can't use the lookup function because the data extension I'm mailing to doesn't have a value I can lookup attributes off of.

What can I do to create this with Ampscript? Basically I'm trying to pull in data from a data extension I'm not emailing to and don't have a matching characteristic to lookup off of

  • So how will you know which row to display in who’s email?
    – zuzannamj
    Jun 29, 2022 at 21:47

1 Answer 1


I'd suggest adding a new Number field to your data extension called lookupKey and set it's default value to 1.

Export your data and import it back into your Data Extension, so all the new rows will have a default value of 1 in the lookupKey field.

Then your lookup could be something like this:


set @rebates = LookupOrderedRows("Rebates",0 ,"Rebate_StartDate asc", "lookupKey","1")
set @rowCount = RowCount(@rebates)

for @i = 1 to @rowCount do

  set @row = Row(@rebates,@i)
  set @Rebate_StartDate = field(@row, "Rebate_StartDate")
  set @Rebate_endDate = field(@row, "Rebate_endDate")
  set @Rebate_amount = field(@row, "Rebate_amount")
  set @Rebate_Text = field(@row, "Rebate_Text")

  if FormatDate(Now(),"YYYY/MM/dd") >= FormatDate(@Rebate_StartDate,"YYYY/MM/dd") 
     and FormatDate(Now(),"YYYY/MM/dd") <= FormatDate(@Rebate_endDate,"YYYY/MM/dd") then


      <br>Rebate_StartDate: %%=v(@Rebate_StartDate)=%%
      <br>Rebate_endDate: %%=v(@Rebate_endDate)=%%
      <br>Rebate_amount: %%=v(@Rebate_amount)=%%
      <br>Rebate_Text: %%=v(@Rebate_Text)=%%

        <br>No rebates available.

next @i 

  • This worked perfectly. Thank you for your help! Jul 8, 2022 at 14:51

You must log in to answer this question.

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