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

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 Mar 2 '17 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)=%%

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.