Nested Tables
Nested tables combine loops with table structures to render complex, hierarchical tabular data. They are useful for grouped fee schedules, multi-entity portfolios, and categorised asset breakdowns.
Syntax
A nested table uses an outer loop to create section headers and an inner loop to populate rows within each section.
Template syntax
{{#each portfolio_groups}}
**{{group_name}}**
| Fund Name | Balance | Allocation |
|---------------|-------------|------------|
| {{#each funds}} |
| {{name}} | {{balance}} | {{alloc}}% |
| {{/each}} |
| **Subtotal** | **{{subtotal}}** | |
{{/each}}When to use nested tables
- Grouped assets — separate tables per asset class or account.
- Multi-entity reports — one table per client in a joint advice scenario.
- Fee comparison — current vs. recommended fee structures side by side.
Subtotals
Use the
{{sum}} helper inside each group to calculate subtotals. Place a final {{sum}} outside the outer loop for a grand total.Example data
Data
{
"portfolio_groups": [
{
"group_name": "Growth Assets",
"subtotal": "$200,000",
"funds": [
{ "name": "Aus Equities Fund", "balance": "$120,000", "alloc": 40 },
{ "name": "Intl Equities Fund", "balance": "$80,000", "alloc": 27 }
]
},
{
"group_name": "Defensive Assets",
"subtotal": "$100,000",
"funds": [
{ "name": "Fixed Interest Fund", "balance": "$60,000", "alloc": 20 },
{ "name": "Cash Account", "balance": "$40,000", "alloc": 13 }
]
}
]
}Table formatting
Column widths and styling are inherited from your uploaded template document. Ensure your template file has the table columns pre-formatted to the desired widths.