I am trying to pull blog info in one of our emails. the issue that I have is that I do not have a field that I can match on between the Sendable Data Extension & the non sendable data extension where I have the blog related data.
In the sendable data extension I have a destination field: example:
Rome, Lucca, Florence, Venice and Assisi
And in the blog piece I have a Location_City field data example: Rome|Florence
We agreed that if the first location from both of these data extension matches we will pull blog content otherwise will have a fallback content.
I had to add in the non sendable DE a default field of 1 as detailed here:
Below is my code:
%%[ SET @Location=AttributeValue('Product: Description') SET @virgula=',' if IndexOf(@Location,@virgula) > 0 then SET @PrimaryLocation=Substring(@Location,1, Subtract(IndexOf(@Location,@virgula),1)) else SET @PrimaryLocation=@Location endif SET @rows = LookupRows("Blog Post Reference Table","Default","1") 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 @Article = field(@row,"Article Title") set @Description = field(@row,"Description") set @Image = field(@row,"Image") SET @LinkTrip=field(@row,"Permalink") set @UrlFinal=RedirectTo(@LinkTrip) set @defaultURl='https://www.trafalgar.com' set @LocationCity=field(@row,"Location_City") set @bara='|' if IndexOf(@LocationCity,@bara) > 0 then SET @LocationCity2=Substring(@LocationCity,1, Subtract(IndexOf(@LocationCity,@bara),1)) else SET @LocationCity2=@LocationCity endif if @PrimaryLocation==@LocationCity2 then ]%% From the blog piece: <br> Article name:%%=v(@Article)=%% <br> Description: %%=v(@Description)=%% <br> <a href="%%=RedirectTo(IIF(@nolink,v(@defaultURl),v(@UrlFinal)))=%%"><img src="%%=v(@Image)=%%"></a> %%[else]%% DEFAULT CONTENT %%[endif]%% %%[next @i ]%% %%[ endif ]%%
Issue that I have is that for the rows where I don't have a match I get the default content; if I take out the else branch I don't have a default content.
I tried to rewrite using LookupOrderedRows but I couldn't get it working?
How should I re-write this in order to pull the default content piece when I do not have a match on the location?