0

I have a DE called content with the following 2 columns - language | text

I need it to return the text from the text column when the language is en

This is what I have, It validates and runs but does not return anything.

Can someone please tell me what I am missing?

%%[ 


var @DEColumn1, @lookupValue 
set @lookupValue = "en" 
set @DEColumn1 = Lookup("content", "text", "Language", @en) 


]%% 
DEColumn1 is %%=v(@DEColumn1)=%%

2 Answers 2

0

A Lookup allows you to pull over a single value from a data extension, since you'll need both values you will want to do a LookupRows and then pull the values out of the row.

Set @rows = LookupRows("content","Language",@lookupValue)
Set @row = Row(@rows,1)
Set @language = field(@row,"language")
Set @text = field(@row,"text")
2
  • Thanks, I tried your solution but get this error when I try to preview. Unable to generate preview Invalid index (parameter 2) passed to Row function. Index must be less than or equal to the row count. Index Value: 1 Row Count: 0 Function: Row(@rows,1)
    – lyslexic
    Aug 22, 2016 at 14:32
  • 1
    That error indicates it can't find the row or the column name from the lookup. Aug 22, 2016 at 15:41
0

You had it looking up @EN but that variable wasn't set. Try this:

%%[ 
     var @DEColumn1, @lookupValue  
     set @lookupValue = "en"  
     set @DEColumn1 = Lookup("content", "text", "Language", @lookupValue) 
]%%  

DEColumn1 is %%=v(@DEColumn1)=%%

2
  • Thanks, I tried. but again it returns absolutely nothing. I double checked my segment, there is data, There's no errors but it just does not return any data. :(
    – lyslexic
    Aug 24, 2016 at 9:13
  • Cancel I got it to work. I was trying to merge in html and it was returning nothing. I cleared my DE and imported text and it works. so.. is there anyway I can import html from a DE into my template? I don't want to use content areas, but rather have this in a DE
    – lyslexic
    Aug 24, 2016 at 9:28

You must log in to answer this question.

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