You use One-to-Many Tables and One-to-Many Data fields to store multiple rows of data for the same recipient. An example of this could be a One-to-Many table that can store data on recipients' purchase histories or subscriptions.
When you create a new One-to-Many Table, you will need a One-to-Many field to contain the ID of the table, followed by any other One-to-Many field that you might need.
How to Create One-to-Many Tables and Data Fields
- Log in to Staging.
- Open the Data module and then select the 'Person Data' section from the left sidebar.
- Click the 'Create' icon in the top toolbar.
- Click the 'One-to-Many Table' button.
- Select 'One-to-Many Table' from the drop-down.
- Fill in a relevant name for the table.
- Click 'Save'.
Creating a new One-to-Many Table
- Click on the 'One-to-Many Table' in the list in the middle work area.
- Click the 'Create' icon in the top toolbar.
- Choose 'Number' or 'String'. This creates the primary key used for your One-to-Many Table. The primary key for your Global Data Table will appear in the work area to the right. A primary key is used to identify the different rows of your One-to-Many Table such as when you're importing data. Because of this, the primary key will always be unique.
- Fill in a name for your primary key in the 'Name' field.
- You can choose to add a description in the 'Description' field.
- Click 'Save'.
Your primary key has been created and you're now ready to add the One-to-Many Data Fields, used to contain your data.
- Click on the 'One-to-Many Table' in the list in the middle work area.
- Click the 'Create' icon in the 'Folders' top toolbar.
- Choose the data type that you want to create your next One-to-Many Table field as.
See Table 1 below. - Fill in a name for your One-to-Many table field in the 'Name' field.
- If you want, add a description in the 'Description' field.
- Click 'Save'.
- Repeat the steps until you have as many One-to-Many table fields as you need.
- Do a Publish to Production to make your One-to-Many table ready for Production recipients' data.
Your One-to-Many Table is now ready to have data imported. We advise you to never create your One-to-Many Table directly on Production. Always create it on Staging and then do a publish to Production. You can read more about our best practice on workflow here.
A One-to-Many Table called 'SUBSCRIPTIONS' gets a new One-to-Many Table field
Data Type: | Description: | Example One-to-Many: | Example Value: |
Boolean | Can either be true or false | PAID | TRUE, FALSE |
Date | Can contain a date | PURCHASE_DATE | 18.01.2018 |
Number | Can contain numbers | POINTS_GAINED, ID | 122, 1 |
String | Can contain any value including letters and numbers | PURCHASE_NAME |
Premium Chocolate Candy |
Timestamp | Can contain a date and time | PURCHASE_ SEND_FROM_STORAGE |
30.12.2017 12:00:12 |
Table 1: Descriptions and examples of all Data Types in Agillic with One-to-Many examples