Repeating data in tables

For email and document communications, you can include repeating data within tables. For example, you may wish to create a table that has 100 rows, each for a different order, specifying such things as order description, price and quantity. EngageOne™ Communicate allows you to create a single row with the appropriate references to data arrays, and then when you preview or send the email or document, the table will be filled out with as many rows as there are in the arrays.

Note: If repeating data is included in a table, the custom row styling for repeating rows is ignored (the table styles are used instead). Other rows that do not have repeating data can be styled as usual.
Note: Currently, repeating data can only be included in text blocks.

To do this, you must first create a JSON or XML file to define the data arrays (an Excel spreadsheet cannot be used). An example of a JSON file that defines two arrays is given below:

Note: The file should contain an array of objects (an array should be the top element of the structure).
[
{
	"firstname": "John",
	"lastname": "Smith",
	"email": "john.smith@mycompany.com",
	"order_number": "5555",
	"delivery_address": [
			"Appartment 234",
			"High Road North",
			"Some Town"
	],	
	"order_items": [
		{
			"description":"Complete Puppy Food",
			"price":"3.49",
			"qty":"2",
			"total":"6.98"
		},
		{
			"description":"Chunky Dog Treats",
			"price":"0.99",
			"qty":"5",
			"total":"4.95"
		}
	],
	"subtotal": "27.55",
	"salestax": "6.88",
	"total": "34.43",
	"est_del_date":"September 12 2019"
}
]
This example has two nested arrays:
  • delivery_address is an example of a string array. EngageOne™ Communicate imports the key of the array as an array. This means that in the metadata generated for the JSON data, the key of that array is marked as array.
  • order_items is an example of an object array. EngageOne™ Communicate imports the key of the array as an array, For all the fields for the JSON objects inside the array, the keys are marked as either string or array, as appropriate.

To create a table with repeating data:

  1. Add a table to the communication (see Tables).
  2. Import the JSON or XML file that defines the arrays as a Data Source (see Data Sources).
  3. Insert text blocks into the cells of the row that you want to repeat.
  4. Hold the mouse above the row and click on Edit row. The following is displayed at the right side:

  5. Click the button to the right of Repeat this row with data to turn this option on. A dropdown is displayed that shows the arrays in the data source:

  6. Select one of these arrays, for example, order_items.
  7. Select the first cell in the row, and click Add personalization. This will now have a menu option order_items >. If you click this, a list of all data items in the array is shown:

  8. From this menu, select the option required for the selected cell (description, price, qty or total). Repeat for the other cells. The table will look like this:

  9. The symbol indicates that the table contains a repeating row.
  10. When you preview or send the email or document, it looks like this:

    There are two rows because in the original JSON file, the array order_items has two entries.
Note: This method will work with:
  • Arrays of plain strings
  • Arrays of plain numbers
  • Arrays of objects
  • Arrays of arrays of objects.

    You can have up to ten levels of nested repeating data.