0

I am trying to build an email using ampscript to pull in data from a DE to populate it. However I can't get past the first part of the script, I keep getting the errors:

"Personalization error: The personalization string "" was not found in the following data extension(s). To fix the problem, please try the following:"

I have done testing and it looks like my data extension is not being recognized as existing and I am not sure what I could be doing wrong. Here is a snippet of my code below

%%[
var @RowNumValue
set @RowNumValue = 0 

var @ReturnRows
set @ReturnRows = 0 

var @GetRows
set @GetRows = LookupOrderedRows("Email_lander",@ReturnRows,"COUPON_CLUSTER","COUPON_ORDER", @RowNumValue) 

var @GetRow, @GetRowCount
set @GetRowCount = rowcount(@GetRows)

if @GetRowCount > 0 then 

var @GetRowNumber
for @GetRowNumber = 1 to @GetRowCount do 

set @GetRow = row(@GetRows,@GetRowNumber) 

var @COUPON_HERO_IMG
set @COUPON_HERO_IMG = field(@GetRow,"COUPON_HERO_IMG")

var @COUPON_HERO_ALT
set @COUPON_HERO_ALT = field(@GetRow,"COUPON_HERO_ALT")

var @COUPON_HERO_LINK
set @COUPON_HERO_LINK = CONCAT(field(@GetRow,"COUPON_HERO_LINK"),"?", @URLtrack)


var @PRINT_BUTTON_LINK
set @PRINT_BUTTON_LINK= CONCAT(field(@GetRow,"PRINT_BUTTON_LINK"),"?", @URLtrack)

var @PRINT_BUTTON_ALT
set @PRINT_BUTTON_ALT = field(@GetRow,"PRINT_BUTTON_ALT")

var @BUY_BUTTON_LINK
set @BUY_BUTTON_LINK= CONCAT(field(@GetRow,"BUY_BUTTON_LINK"),"?", @URLtrack)

var @BUY_BUTTON_ALT
set @BUY_BUTTON_ALT = field(@GetRow,"BUY_BUTTON_ALT")

var @BARCODE_IMG
set @BARCODE_IMG = field(@GetRow,"BARCODE_IMG")

var @BARCODE_IMG
set @BARCODE_IMG = field(@GetRow,"BARCODE_IMG")

var @BARCODE_ALT
set @BARCODE_ALT = field(@GetRow,"BARCODE_ALT")

var @BARCODE_LINK
set @BARCODE_LINK= CONCAT(field(@GetRow,"BARCODE_LINK"),"?", @URLtrack)

var @COUPON_DISCLAIMER_IMG
set @COUPON_DISCLAIMER_IMG = field(@GetRow,"COUPON_DISCLAIMER_IMG")

var @COUPON_DISCLAIMER_ALT
set @COUPON_DISCLAIMER_ALT = field(@GetRow,"COUPON_DISCLAIMER_ALT")


]%%

%%[

next @GetRowNumber ]%%

%%[ else ]%%


%%[ endif ]%%



     <body>

%%[set @RowNumValue = 1]%%

<img src="%%=Field(@COUPON_HERO_IMG("COUPON_ORDER",%%=v(@RowNumValue)=%%)=%%)" alt="%%=Field(@COUPON_HERO_ALT("COUPON_ORDER",%%=v(@RowNumValue)=%%)=%%)">

Right now we are manually updating emails with 100+ tables T_T and it takes hours. I am still new to ampscript and trying to find a way to get this to work and am very stuck.

  • Are you expecting your Lookup to return multiple rows? Also If it does, do you intend to display each rows values (Images, alt text, etc)? or only the first row? – Gortonington Nov 24 '18 at 15:19
1

I think your issue is here:

<img src="%%=Field(@COUPON_HERO_IMG("COUPON_ORDER",%%=v(@RowNumValue)=%%)=%%)" alt="%%=Field(@COUPON_HERO_ALT("COUPON_ORDER",%%=v(@RowNumValue)=%%)=%%)">

This is invalid. I also noticed you have @URLtrack as an AMPscript var, but do not see it declared or set anywhere in your code.

Assuming you want to output image and whatever other content you have for each row returned via your lookup, I would rewrite your code like below:

%%[
var @RowNumValue, @ReturnRows, @GetRows, @GetRow, @GetRowCount, @GetRowNumber

var @COUPON_HERO_IMG, @COUPON_HERO_ALT, @COUPON_HERO_LINK, @COUPON_DISCLAIMER_IMG, @COUPON_DISCLAIMER_ALT

var @PRINT_BUTTON_LINK, @PRINT_BUTTON_ALT

var @BUY_BUTTON_LINK, @BUY_BUTTON_ALT

var @BARCODE_IMG, @BARCODE_ALT, @BARCODE_LINK

var @URLtrack

/* Do not see you setting a value anywhere for @URLtrack or even declaring it as a var */

set @RowNumValue = 0 
set @ReturnRows = 0

set @GetRows = LookupOrderedRows("Email_lander",@ReturnRows,"COUPON_CLUSTER","COUPON_ORDER", @RowNumValue) 
set @GetRowCount = rowcount(@GetRows)

if @GetRowCount > 0 then 

    for @GetRowNumber = 1 to @GetRowCount do 

        set @GetRow = row(@GetRows,@GetRowNumber) 

        set @COUPON_HERO_IMG = field(@GetRow,"COUPON_HERO_IMG")
        set @COUPON_HERO_ALT = field(@GetRow,"COUPON_HERO_ALT")
        set @COUPON_HERO_LINK = CONCAT(field(@GetRow,"COUPON_HERO_LINK"),"?", @URLtrack)
        set @COUPON_DISCLAIMER_IMG = field(@GetRow,"COUPON_DISCLAIMER_IMG")
        set @COUPON_DISCLAIMER_ALT = field(@GetRow,"COUPON_DISCLAIMER_ALT")

        set @PRINT_BUTTON_LINK= CONCAT(field(@GetRow,"PRINT_BUTTON_LINK"),"?", @URLtrack)
        set @PRINT_BUTTON_ALT = field(@GetRow,"PRINT_BUTTON_ALT")

        set @BUY_BUTTON_LINK= CONCAT(field(@GetRow,"BUY_BUTTON_LINK"),"?", @URLtrack)
        set @BUY_BUTTON_ALT = field(@GetRow,"BUY_BUTTON_ALT")

        set @BARCODE_IMG = field(@GetRow,"BARCODE_IMG")
        set @BARCODE_ALT = field(@GetRow,"BARCODE_ALT")
        set @BARCODE_LINK= CONCAT(field(@GetRow,"BARCODE_LINK"),"?", @URLtrack)

        ]%%

        <img src="%%=v(@COUPON_HERO_IMG)=%%" alt="%%=v(@COUPON_HERO_ALT)=%%" />
        <!-- and whatever other content you have here -->

%%[ next @GetRowNumber

endif ]%%

or if you only want to return a single result, you can use the below:

%%[
var @RowNumValue, @ReturnRows, @GetRows, @GetRow, @GetRowCount, @GetRowNumber

var @COUPON_HERO_IMG, @COUPON_HERO_ALT, @COUPON_HERO_LINK, @COUPON_DISCLAIMER_IMG, @COUPON_DISCLAIMER_ALT

var @PRINT_BUTTON_LINK, @PRINT_BUTTON_ALT

var @BUY_BUTTON_LINK, @BUY_BUTTON_ALT

var @BARCODE_IMG, @BARCODE_ALT, @BARCODE_LINK

var @URLtrack

/* Do not see you setting a value anywhere for @URLtrack or even declaring it as a var */

set @RowNumValue = 0 


set @GetRows = LookupOrderedRows("Email_lander",1,"COUPON_CLUSTER","COUPON_ORDER", @RowNumValue) 
set @GetRowCount = rowcount(@GetRows)

if @GetRowCount > 0 then 

    set @GetRow = row(@GetRows,1) 

    set @COUPON_HERO_IMG = field(@GetRow,"COUPON_HERO_IMG")
    set @COUPON_HERO_ALT = field(@GetRow,"COUPON_HERO_ALT")
    set @COUPON_HERO_LINK = CONCAT(field(@GetRow,"COUPON_HERO_LINK"),"?", @URLtrack)
    set @COUPON_DISCLAIMER_IMG = field(@GetRow,"COUPON_DISCLAIMER_IMG")
    set @COUPON_DISCLAIMER_ALT = field(@GetRow,"COUPON_DISCLAIMER_ALT")

    set @PRINT_BUTTON_LINK= CONCAT(field(@GetRow,"PRINT_BUTTON_LINK"),"?", @URLtrack)
    set @PRINT_BUTTON_ALT = field(@GetRow,"PRINT_BUTTON_ALT")

    set @BUY_BUTTON_LINK= CONCAT(field(@GetRow,"BUY_BUTTON_LINK"),"?", @URLtrack)
    set @BUY_BUTTON_ALT = field(@GetRow,"BUY_BUTTON_ALT")

    set @BARCODE_IMG = field(@GetRow,"BARCODE_IMG")
    set @BARCODE_ALT = field(@GetRow,"BARCODE_ALT")
    set @BARCODE_LINK= CONCAT(field(@GetRow,"BARCODE_LINK"),"?", @URLtrack)

endif 
]%%

<img src="%%=v(@COUPON_HERO_IMG)=%%" alt="%%=v(@COUPON_HERO_ALT)=%%" />
<!-- and whatever other content you have here -->
  • I had set urltrack higher up and forget to paste it. I am trying to display one result but I have a table of 100+ results I need to display throughout the one email. Do I have to set a loop for each row or is there a way around it? See example below. COUPON_HERO_IMG COUPON_HERO_ALT COUPON_HERO_LINK 1 2 3 4 5 etc to 100+ – 5J55 Nov 26 '18 at 17:12
  • You would need to use my first example and put all the dynamic content into the <img src="%%=v(@COUPON_HERO_IMG)=%%" alt="%%=v(@COUPON_HERO_ALT)=%%" /> <!-- and whatever other content you have here --> section. I wouldn't recommend doing a lookup and for loop with over 100 rows inside an email. That is going to be a huge resource draw and potentially cause errors or time outs. – Gortonington Nov 26 '18 at 18:35
  • Would it be possible to at least send out to build an email and extract the HTML from Outlook? If I need the rows returned in different sections of the email is it still possible to use the first example? like – 5J55 Nov 26 '18 at 22:27
  • <a href="%%=v(@COUPON_HERO_IMG)=%%" alt="%%=v(@COUPON_HERO_ALT)=%%"><img src="@COUPON_HERO_LINK"/></a></td></tr> <tr> <td><a href="%%=v(@COUPON_HERO_LINK)=%%" alt="%%=v(@COUPON_HERO_ALT=%%"><img src="%%=v(@COUPON_HERO_LINK)=%%" /></a></td> How does it know which row to look for? Or I have to set each loop? Sorry still a little confused. – 5J55 Nov 26 '18 at 22:40
  • it needs to be set in each loop. If you don't set it inside the loop it will only pull the last values set from the loop. – Gortonington Nov 27 '18 at 13:53

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.