In my sendable data extension I have 1 or more possible destinations separated by ; For my use case I need to pull the first 2 destinations from the sendable DE.
I am referencing these destinations into a non sendable data extension where I have different blog articles and multiple images. I want to be able to limit the number of articles to 3 from the non sendable data extension for either the first location or second location from the sendable Data extension. (depending on the combination of destinations I can have different number of articles pulled in my email)
Issue I am facing is that I can either bring all the articles (as in the script below) or I am able to limit it to 1 but I am not sure how I can re-write the script to show me 3 articles for either destination 1 or destination 2 in my Data Extension.
I have attached an example of my sendable DE & non sendable I am referencing.
%%[ SET @Location=AttributeValue('Destination') SET @virgula=';' if IndexOf(@Location,@virgula) > 0 then SET @rs = BuildRowsetFromString(@Location,';') SET @PrimaryLocation = Field(Row(@rs,1),1) SET @SecondaryLocation = Field(Row(@rs,2),1) else SET @PrimaryLocation=@Location SET @SecondaryLocation=@Location endif ]%% Primary location: %%=v(@PrimaryLocation)=%% <br> Secondary location: %%=v(@SecondaryLocation)=%%<br><br> %%[SET @rows = LookupRows("PBN Cris Reference","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") set @Image = field(@row,"Image") set @Destination2=field(@row,"Destination") /* checking for the match on location */ if (@PrimaryLocation == @Destination2) or (@SecondaryLocation == @Destination2) then SET @match = 1]%% Article: %%=v(@Article)=%%<br> Image: %%=v(@Image)=%% <br><br> %%[ENDIF NEXT @i ELSE ]%% %%[ ENDIF ]%%