There are two ways to present looped collection data in table format. You can use collection loops, or use the table row/column functions -w:tr
and -w:tc
.
Syntax
Always ensure that the collection appears in the left-most (first) cell of the table along with either the opening tag {#} or the table functions you are using, and the corresponding closing tag is in the right-most (last) cell of the table.
Collection Variables
By creating a collection loop within a row in a table, each new repeated data loop will add a new row to the table.
Sample Shareholdings Data |
Fiona Forrest holds 100 Common shares Gemma Germinate holds 50 Common shares Herbert Horticulture holds 100 Common shares Isabella Iridescence holds 25 Common shares Julian Juniper holds 10 Common shares |
Sample Code
Shareholder Name | Number & Class of Shares Held |
{#shareholdings}{shareholdingName} | {numShares | commaSeparate}{className}{/} |
Sample Output
Shareholder Name | Number & Class of Shares Held |
Fiona Forrest | 100 Common |
Gemma Germinate | 50 Common |
Herbert Horticulture | 100 Common |
Isabella Iridescence | 25 Common |
Julian Juniper | 10 Common |
Table Functions
These notations allows you to fill in a table by generating additional rows with -w:tr
or columns with -w:tc
.
Using -w:tr Notation
Sample Code
Shareholder Name | Number & Class of Shares Held |
{-w:tr shareholdings}{shareholdingName} | {numShares | commaSeparate}{className}{/} |
Sample Output
Shareholder Name | Number & Class of Shares Held |
Fiona Forrest | 100 Common |
Gemma Germinate | 50 Common |
Herbert Horticulture | 100 Common |
Isabella Iridescence | 25 Common |
Julian Juniper | 10 Common |
Using -w:tc Notation
Sample Code
Shareholder Name | {-w:tc shareholdings}{shareholdingName}{/} |
Number & Class of Shares Held | {-w:tc shareholdings}{numShares | commaSeparate}{className}{/} |
Sample Output
Shareholder Name | Fiona Forrest | Gemma Germinate | Herbert Horticulture | Isabella Iridescence | Julian Juniper |
Number & Class of Shares Held | 100 Common |
50 Common |
100 Common | 25 Common | 10 Common |
Use the Right Notations Correctly!
Error #1: Using -w:tc
Instead of -w:tr
Shareholder Name | Number & Class of Shares Held |
{-w:tc shareholdings}{shareholdingName} | {numShares | commaSeparate}{className}{/} |
Bad Output #1
Shareholder Name | Number & Class of Shares Held | ||||||||
Fiona Forrest | 100 Common | Gemma Germinate | 50 Common | Herbert Horticulture | 100 Common | Isabella Iridescence | 25 Common | Julian Juniper | 10 Common |
-w:tc
onlyShareholder Name | {-w:tc shareholdings}{shareholdingName} |
Number & Class of Shares Held | {numShares | commaSeparate}{className}{/} |
Shareholder Name | Fiona Forrest | |
Number & Class of Shares Held | 100 Common | Gemma Germinate |
Number & Class of Shares Held | 50 Common | Herbert Horticulture |
Number & Class of Shares Held | 100 Common | Isabella Iridescence |
Number & Class of Shares Held | 25 Common | Julian Juniper |
Number & Class of Shares Held | 10 Common |