I have 3 Data Extensions:
- one used as target which is the audience to contact
- one which stores products and email addresses. Here the email addresses match the ones present in the previous DE
- one containing products of fallbacks, used in case the email address of the DE target is not in the second DE
I would like to retrieve in the same ampscript info stored in the second and third DE. The logic behind is: if the email address of target DE is in the second DE, then retrieve the products in the second DE, otherwise retrieve the products in the third DE (where there is no match of email addresses)
The ampscript below only retrieve products from DE_2 where I have the list of products per email addresses.
%%[ VAR @email, @rows, @rowCount, @counter, @row, @productdescription SET @email = [email] SET @rows = LookupRows("DE_2", "email", @email) SET @rowCount = RowCount(@rows) IF @rowCount > 0 THEN FOR @counter = 1 TO @rowCount Do SET @row = Row(@rows,@counter) SET @@productdescription = Field(@row,"@productdescription") ]%% %%=v(@@productdescription)=%% %%[ next @counter ENDIF ]%%