Numbered and Bulleted Lists

The Encodian population engine supports all types of lists including multi-level lists. The source JSON data must be in the form of an array, i.e. one or more items in the list.

This article provides detailed examples for the following topics/scenarios:

General Syntax

Populate a Bulleted List

Populate a Numbered List

Populate a Multi-Level List

General Syntax

Consider the following example JSON data:

{
"bullets": [
{
"listFirstName": "Efren",
"listLastName": "Gaskill"
},
{
"listFirstName": "Sanly",
"listLastName": "Keyme"
},
{
"listFirstName": "Mark",
"listLastName": "Nigma"
}
]
}

Firstly the following syntax should be used to instruct the word document to populate each item within the 'bullets' array object:

<<foreach [bullet in bullets]>>
<</foreach>>

Within the for each token you can then specify which properties from each item within the array to write out, for example:

<<foreach [bullet in bullets]>><<[bullet.listFirstName]>>
<</foreach>>

Or the following variation:

<<foreach [in bullets]>><<[listFirstName]>>
<</foreach>>

Populate a Bulleted List

Example Document: Encodian - Template Syntax - Bulleted List.docx

Example JSON Data:

{
"companyName":"Encodian",
"bullets": [
{
"listFirstName": "Efren",
"listLastName": "Gaskill"
},
{
"listFirstName": "Sanly",
"listLastName": "Keyme"
},
{
"listFirstName": "Mark",
"listLastName": "Nigma"
}
]
}

The word document should be set up with the first bullet and then the token/syntax configuration added, for example:

<<foreach [bullet in bullets]>><<[bullet.listFirstName]>> <<[bullet.listLastName]>>
<</foreach>>

mceclip0.png

This generates the following output:

mceclip1.png

Populate a Numbered List

Example Document: Encodian - Template Syntax - Numbered List.docx

Example JSON Data:

{
"companyName":"Encodian",
"bullets": [
{
"listFirstName": "Efren",
"listLastName": "Gaskill"
},
{
"listFirstName": "Sanly",
"listLastName": "Keyme"
},
{
"listFirstName": "Mark",
"listLastName": "Nigma"
}
]
}

The word document should be set up with the first item and then the token/syntax configuration added, for example:

<<foreach [bullet in bullets]>><<[bullet.listFirstName]>> <<[bullet.listLastName]>>
<</foreach>>

mceclip3.png

This generates the following output:

mceclip2.png

Populate a Multi-Level List

Example Document: Encodian - Template Syntax - Multiple Level List.docx

Example JSON Data:

{
"companyName": "Encodian",
"bullets": [
{
"listFirstName": "Efren",
"listLastName": "Gaskill",
"colleagues": [
{
"name": "Bill Gates"
},
{
"name": "Paul Allen"
},
{
"name": "Steve Ballmer"
}
]
},
{
"listFirstName": "Sanly",
"listLastName": "Keyme"
},
{
"listFirstName": "Mark",
"listLastName": "Nigma",
"colleagues": [
{
"name": "Larry Page"
},
{
"name": "Sergey Brin"
}
]
}
]
}

The word document should be set up with the first and secondary bullets and then the token/syntax configuration added, for example:

<<foreach [bullet in bullets]>><<[bullet.listFirstName]>> <<[bullet.listLastName]>>
<<foreach [colleague in bullet.colleagues]>><<[colleague.name]>>
<</foreach>><</foreach>>

mceclip5.png

This generates the following output:

mceclip6.png

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk