A Crosstab report is one that breaks out a group against one or more other groups.
This type of report has an enforced structure to ensure, for example, that all rows have the same number of columns. (Examples)
The code to generate Crosstab reports looks like this:
#indicates the start of a crosstab{|CROSSTAB|}
#this starts our outer loop, which in this case is year (sorted by order num)
{|LOOP|CROSSTAB.YEAR(SORT=ORDER_NUM)}
#this section is the header and we specifically
#show it only if we're on the first year
{|SHOWIF|LOOP.ISFIRST}
<table class='data'>
<thead>
<tr>
<th>Name</th>
#now we loop our months and display a header cell for each one
{|LOOP|YEAR.MONTH_OF_YEAR(SORT=ORDER_NUM)}
#this displays the month's name in the header cell
<th>{MONTH_OF_YEAR.NAME}</th>
{/|LOOP|}
</tr>
</thead>
<tbody>
#close off the header section
{/|SHOWIF|}
<tr>
#display the group name as a header for the row
<th>{YEAR.NAME}</th>
#loop the months again for each year
{|LOOP|YEAR.MONTH_OF_YEAR}
#display a count of datapoints belonging to this month in this year
<td>{COUNT(MONTH_OF_YEAR)}</td>
{/|LOOP|}
</tr>
#this section only displays for the last time
#through the loop and closes out our table
{|VANISHIF|LOOP.HASNEXT}
</tbody>
</table>
#close off the footer section
{/|VANISHIF|}
#end the loop of years
{/|LOOP|}
#close off the crosstab section
{/|CROSSTAB|}