First, I'd move the retrieval inside your @card_type
conditional and output each @contentArea
value. Like this:
%%[
Var @card_type, @Row, @rows, @ac, @au, @ea, @se, @ContentArea1, @ContentArea2, @ContentArea3, @ContentArea4, @ContentArea5, @ContentArea6, @ContentArea7, @ContentArea8, @ContentArea9, @ContentArea10, @ContentArea11, @ContentArea12, @ContentArea13
SET @card_type = [CARD_TYPE]
SET @ac = [AC]
SET @au = [AU]
SET @ea = [EA]
SET @se = [SE]
IF Not Empty(@card_type) THEN
SET @rows = LookupRows("forum-lookup-rows - 1","card_type", [CARD_TYPE])
IF RowCount(@rows) > 0 THEN
SET @row = Row(@rows,1)
SET @ContentArea1 = Field(@row,"ContentArea1")
SET @ContentArea2 = Field(@row,"ContentArea2")
SET @ContentArea3 = Field(@row,"ContentArea3")
SET @ContentArea4 = Field(@row,"ContentArea4")
SET @ContentArea5 = Field(@row,"ContentArea5")
SET @ContentArea6 = Field(@row,"ContentArea6")
SET @ContentArea11 = Field(@row,"ContentArea11")
IF @ac == 'n' THEN
SET @ContentArea7 = Field(@row,"ContentArea7")
ELSEIF @ea == 'n' THEN
SET @ContentArea8 = Field(@row,"ContentArea8")
ELSEIF @au == 'n' THEN
SET @ContentArea9 = Field(@row,"ContentArea9")
SET @ContentArea12 = Field(@row,"ContentArea12")
/*ELSEIF @au == 'y' THEN
SET @ContentArea13 = Field(@row,"ContentArea13")*/
ELSEIF @se == 'n' THEN
SET @ContentArea10 = Field(@row,"ContentArea10")
ENDIF
ENDIF
ENDIF
]%%
@card_type: %%=v(@card_type)=%%<br>
@ac: %%=v(@ac)=%%<br>
@au: %%=v(@au)=%%<br>
@ea: %%=v(@ea)=%%<br>
@se: %%=v(@se)=%%<br><br>
@ContentArea1: %%=v(@ContentArea1)=%%<br>
@ContentArea2: %%=v(@ContentArea2)=%%<br>
@ContentArea3: %%=v(@ContentArea3)=%%<br>
@ContentArea4: %%=v(@ContentArea4)=%%<br>
@ContentArea5: %%=v(@ContentArea5)=%%<br>
@ContentArea6: %%=v(@ContentArea6)=%%<br>
@ContentArea11: %%=v(@ContentArea11)=%%<br><br>
@ContentArea7: %%=v(@ContentArea7)=%%<br>
@ContentArea8: %%=v(@ContentArea8)=%%<br>
@ContentArea9: %%=v(@ContentArea9)=%%<br>
@ContentArea12: %%=v(@ContentArea12)=%%<br>
@ContentArea10: %%=v(@ContentArea10)=%%<br>
For any @ContentArea*
field that's empty the email's going to blow up. You'll either need to have some default content for those or conditionally display alternate content in the body of the email. You might utilize an iif()
function -- like this:
%%=iif(empty(@ContentArea1),"not found", ContentArea(@ContentArea1))=%%
First, I'd suggest setting a primary key on your MatthewDataExtension
Data Extension, since the ClaimRow()
function is doing an update.
Also, every pair of ClaimRow()
parameters after the 2nd needs to be the variable name and then the variable value -- in order to retrieve the proper row. So if you're going to update WebPromoCode
and StoreCouponCode
, your function would be this:
%%[
var @numberCustomer
var @WebPromoCode
var @StoreCouponCode
set @numberCustomer = AttributeValue("Customer_No")
set @WebPromoCode = AttributeValue("WebPromoCode")
set @StoreCouponCode = AttributeValue("StoreCouponCode")
set @couponDataExtensionRow = ClaimRow("MatthewDataExtension", "isClaimed", "WebPromoCode", @WebPromoCode, "StoreCouponCode", @StoreCouponCode , "Customer_No", @numberCustomer)
/* Snip */
]%%
If it helps, here's my go-to coupon claiming AMPScript:
%%[
var @couponRow, @couponCode, @rows, @row, @emailaddr
set @emailaddr = AttributeValue("emailaddr")
set @rows = LookupRows("couponCodes","EmailAddress",@emailaddr)
if rowcount(@rows) > 0 then
set @row = Row(@rows,1)
set @couponCode= field(@row,"couponCode")
else
if _messagecontext == "PREVIEW" then
set @couponCode = "XX TEST XX"
else
set @couponRow = ClaimRow("couponCodes","IsClaimed","EmailAddress",emailaddr)
if empty(@couponRow) then
/* You can do other error handling here if you want.*/
/* This aborts the send */
raiseError("no more coupons available")
else
set @couponCode= field(@couponRow,"couponCode")
endif
endif
endif
]%%
Here's your coupon code: %%=v(@couponCode)=%%
There are a few more details about the Data Extension on in my blog post on the subject.
Best Answer
For content stored inside of ContentBuilder, you will need to use the 'new' AMPscript functions. Not sure on the details of why, but in building Content Builder / Email Studio, they completely removed the storage location from the previous Portfolio section. The bad thing about this is that a lot of options that previously worked, no longer work on Content Builder stuff.
To answer your question you will need to use either:
ContentBlockByID (
%%=ContentBlockbyID("384201")=%%
)or
ContentBlockByKey (
%%=ContentBlockbyKey("myContentBlock")=%%
)You should be able to find both of these easily inside the properties field of the content area.