We have a coupon email, and it is deploying to a large Data Extension and a number of records are duplicates (they qualify for multiple coupons). However, when we do the lookup the second row pulls in the coupon from the first row. If you're in the email twice, you should get two emails.

Our Primary Key in the Data Extension is the Order Number (if you ordered, you get a coupon), but we can't get the second coupon code with the second Order Number into the email.

Here's our attempt:

%%[SET @DEname = "JAN2017_Orders"]%% <br />
<br />
%%[SET @orderNumber = Lookup(@DEname, "Order Number", "Email", emailaddr)]%%<br />
%%[SET @couponValue = Lookup(@DEname, "Coupon Value", "Order Number", @orderNumber)]%%<br />
%%[SET @couponCode = Lookup(@DEname, "Coupon Code", "Order Number", @orderNumber)]%%<br />
%%[SET @itemNumbers = Lookup(@DEname, "Items", "Order Number", @orderNumber)]%%<br />
%%[SET @itemNames = Lookup (@DEname, "Product Description List", "Order Number", @orderNumber)]%%<br />
%%[SET @CustomerName = Lookup(@DEname, "Customer Name", "Email", emailaddr)
]%%<br />

It looks like you need two keys: order number/email address. With that system your sendable DE can look up what it needs from your Jan2017_orders, and then you can skip the order number lookup in your ampscript because it should be recipient data at that point and can be used to fetch the proper coupon data.

That way you can send email to duplicates and have it key off of the right order number. Does that make sense?

| improve this answer | |
  • Does this mean select TWO primary keys in the DE? – George Rosedale Jan 31 '17 at 21:54
  • 1
    Yes the combination of order/address make a unique key. – Matthew Wash Feb 1 '17 at 14:13

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.