-3

The problem is the connection between the template ampscipt names and the set names in the library. It’s not connecting and pulling the copy

%%[

Set @m1 = 'DIN'
Set @p1_copy = TreatAsContent(Concat("%%=v(",@m1,"_copy)=%%"))
Set @DIN_copy ="workie workie"

]%%


<p>

load copy here %%=v(@p1_copy)=%% like this text.
</p>

1 Answer 1

2

Not sure I understand your use-case completely, but you certainly can do what you've illustrated in your code but you have to separate the double-percents in the concat.

You'll also need to define @DIN_copy before you use the TreatAsContent/Concat combo. The TreatAsContent forces the AMPscript to get evaluated.

%%[

Set @m1 = 'DIN'
Set @DIN_copy = "workie workie"
Set @p1_copy = TreatAsContent(Concat("%", "%=v(",@m1,"_copy)=%","%"))

]%%
<p>
load copy here %%=v(@p1_copy)=%% like this text.
</p>

(Credit: This answer by jake314159)

Lastly, template and email code are evaluated from the top down, so there should be no need to do anything special to define/read variable values between template and email. It's all the same context at the time the AMPscript is evaluated.

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