Data Relationships

This example demonstrates how to display the order history of a subscriber, including any product reviews and the ratings for the purchased products.

Create these data extensions in your account.

  1. MyContacts

    • SubscriberKey - primary key, text
    • EmailAddress - text
    • First_Name - text
    • Last_Name - text
    • Language - text
    • City - text
    • Category_Preference - number
  2. Products

    • Product_Name - text
    • SKU - primary key, number
    • Thumbnail_URL - text
    • Product_Category - number
  3. Product_Rating

    • Average_Rating - number
    • SKU - primary key, number
    • Number_of_Ratings - number
    • Last_Review_Text - text
  4. Order_Details

    • SKU - primary key, number
    • OrderID - primary key, number
    • CustomerID - text

Follow these steps to create each of your data extensions:

  1. Hover over Subscribers.
  2. Click Data Extensions.
  3. Click Create.
  4. Choose Standard Data Extension.
  5. Click OK.
  6. Choose Create From New for Creation Method.
  7. Enter the name of the data extension in the Name field.
  8. Enter the value used to access the data extension via an API call in the External Key field.
  9. Enter a description of the data extension in the Description field.
  10. Choose the location for the new data extension in the Location field.
  11. Click Next twice to skip the Data Retention Options.
  12. Create the attributes for your data extension as shown in the previous list.
  13. Click Next.
  14. Click Create.

Follow the directions to create a data relationship using the data extensions listed in Step 1. These steps build these data relationships:

  • Order_Details to MyContacts (linking CustomerID to SubscriberKey)
  • Products to Order_Details (linking SKU to SKU)
  • Product_Ratings to Products (linking SKU to SKU)
  1. Hover over Subscribers.

  2. Click Data Relationships.

  3. Click Create.

  4. Enter a name for the data relationship in the Name field. Enter the value you wish to use to access the data relationship via an API call in the External Key field.

  5. Enter a description of the data extension in the Description field as necessary.

  6. Choose the Order_Details and MyContacts data extensions in the Select Object section drop-downs.

  7. Choose the CustomerID field for the Order_Details data extension and the SubcriberKey field for the MyContacts data extension in the Select Field section.

  8. Click Save. Repeat steps 7 through 9, substituting the supplied data, to establish the other necessary data relationships:

    • Products data extension (SKU field) to Order_Details data extension (SKU field)
    • Product_Ratings data extension (SKU field) to Products data extension (SKU field)

Follow the instructions to create a subscriber in the Create a Subscriber section or use the same subscriber created earlier.

Follow the instructions to create a message in the Create an Email and use the following template for your content:

Given this data content:

The email message renders as displayed:

Screenshot of email created using Data Relationships