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.
-
MyContacts
- SubscriberKey - primary key, text
- EmailAddress - text
- First_Name - text
- Last_Name - text
- Language - text
- City - text
- Category_Preference - number
-
Products
- Product_Name - text
- SKU - primary key, number
- Thumbnail_URL - text
- Product_Category - number
-
Product_Rating
- Average_Rating - number
- SKU - primary key, number
- Number_of_Ratings - number
- Last_Review_Text - text
-
Order_Details
- SKU - primary key, number
- OrderID - primary key, number
- CustomerID - text
Follow these steps to create each of your data extensions:
- Hover over Subscribers.
- Click Data Extensions.
- Click Create.
- Choose Standard Data Extension.
- Click OK.
- Choose Create From New for Creation Method.
- Enter the name of the data extension in the Name field.
- Enter the value used to access the data extension via an API call in the External Key field.
- Enter a description of the data extension in the Description field.
- Choose the location for the new data extension in the Location field.
- Click Next twice to skip the Data Retention Options.
- Create the attributes for your data extension as shown in the previous list.
- Click Next.
- 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)
-
Hover over Subscribers.
-
Click Data Relationships.
-
Click Create.
-
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.
-
Enter a description of the data extension in the Description field as necessary.
-
Choose the Order_Details and MyContacts data extensions in the Select Object section drop-downs.
-
Choose the CustomerID field for the Order_Details data extension and the SubcriberKey field for the MyContacts data extension in the Select Field section.
-
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: