I have a send DE and a lookup DE, both have in common the email address. In the lookup DE, the same email address will be listed multiple times if the subscriber has multiple products.
Send DE has the fields: Subscriber_key | Email
Lookup DE has the fields: Email | Product | NumberOfPoints
How can I get all the products and numberofpoints for each email address with AMPscript? I want to be able to assign variables for each product and numberofpoints someone has. E.g. JamesSmith@gmail.com has Visa with 999 points and Mastercard with 12345 points. I need to be able to wrap each of these values in variables so I can compare them later.
I know FOR will do it but I just cannot figure it out.
%%[ SET @Email = AttributeValue("Email") SET @ProductDetails = LookUpOrderedRows("LookUpDE", 0, "Product ASC", "Email", @Email) SET @CountPD = RowCount(@ProductDetails) IF @CountPD > 0 THEN FOR @i = 1 to @CountPD DO SET @Row = Row(@ProductDetails, @i) SET @Product = Field(@Row, "Product") SET @NumberOfPoints = Field(@Row, "NumberOfPoints") NEXT @i ENDIF ]%% %%=v(@Email)=%%<br> %%=v(@Product)=%%<br> %%=v(@NumberOfPoints)=%%<br>