0

I am trying to create a data extension that houses AMPscript within it.

Within the email itself, I've placed this code just after the open body tag:

%%[
Var @orgname, @short
Set @orgname = "Company Name"
Set @short = "Company"
]%%

Within the data extension, one column has the following text:

I really want `%%=v(@orgname)=%%` to contact me. Thank you `%%=v(@short)=%%`.

So with the preview function, it yields:

I really want Company Name to contact me. Thank you Company.

But I'm not able to get this to work. What am I doing wrong? Is this even possible?

2 Answers 2

2

You'll need to wrap the column data variable in a treatascontent() function to force the AMPScript to get evaluated:

%%[

var @col1

/* DE lookupRows code here */

set @col1 = field(@rows,"col1")

]%%
DE field with AMPScript: %%=treatascontent(@col1)=%%
1
  • Thank you, this was challenging and helpful. We were able to figure it out. I posted my example below yours for other's to reference.
    – JMStelter
    Commented Mar 2, 2017 at 16:00
0

For anyone who happens to come upon this question, we were able to figure this out:

%%[ VAR @orgname, @delookup, @subkey, @short 
SET @orgname = "Company Name" 
SET @short = "company" 
SET @subkey = [Subscriber Key] 
SET @delookup = Lookup("NameofDE", "ampscriptnametogohere", "Subscriber Key", @subkey) ]%%

%%=treatascontent(@delookup)=%%

You must log in to answer this question.

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