I am trying to determine if I can use data that is set up in a related (non-sendable) Data Extension to personalize an email that I will send to a parent (sendable) data extension. I have two data extensions, one containing subscriber emails and demographic information, and the other containing sold product information. I want to be able to use the related (non-sendable) product data extension to populate data on a newsletter based on which products each subscriber has purchased, but the product data does not live in the subscriber data extension. It is only a related data extension. Is there a way that I can use this relational data to drive my content?
One way to accomplish this would be to use the primary key relationship to pull in the necessary data via AMPscript. The Lookup() function would be one such example that could accomplish what you're trying to to.
%%[ /* Initialize variables */ var @subPkey, @fieldFromProductDE /* Set the @subPkey variable to the primary key field on your sending DE */ set @subPkey = AttributeValue("pkeyField") /* Use the Lookup() function to pull the productField value where DE1 primary key matches the primary key on product (in this case "productPkey") */ set @fieldFromProductDE = Lookup("ProductDE", "productField", "productPkey", @subPkey) if @fieldFromProductDE == "ProductA" then ]%% Content Block A %%[Else]%% Content Block B %%[endif]%% %%=v(@fieldFromProductDE)=%%
This will first pull in the primary key from your sending DE, and relate it to the primary key field on your related product DE. It will return the value from the field you've entered as your second argument in the Lookup function.