I cannot figure out how to write an ampscript in order to bring the content from a non sendable data extension in my email content; in this DE i have the trip name, trip URL & trip image and I want to be able to use these in my email and should work for all data extensions that I am sending to.
I have created the Trip Name as a profile attribute and written the following code so far:
%%[VAR @TripName,@TripURL2,@TripImage2
SET @TripName=AttributeValue('Trip Name')
SET @rows = LookupRows("Trip Data","Trip Name",@TripName)
set @rowCount = rowcount(@rows)
if @rowCount > 0 then
for @i = 1 to @rowCount do
set @row = row(@rows, @i) /* get row based on counter */
set @TripName2 = field(@row,"Trip Name")
set @TripURL2 = field(@row,"Link URL")
set @TripImage2 = field(@row,"Image URL")
]%%
<br>Row %%=v(@i)=%%
<br>Trip Name: %%=v(@TripName2)=%%
<br>Link URL %%=v(@TripURL2)=%%
<br>Image URL %%=v(@TripImage2)=%%
%%[
next @i ]%%
%%[ else ]%%
No rows found
%%[ endif ]%%
of course when i do the send preview i get the no rows found message; I am trying to use this non sendable DE in order to build my email content from.
What am I doing wrong?
SET @TripName = "Best of Belgium"
. Still no rows found?@TripName
, output it to make sureAttributeValue("Trip Name")
is actually returning a value:Output(Concat("Trip Name: ", @TripName))
.