An example of how to fill tables with data and manage what happens when the table runs over the bottom of the page.
Includes examples of Date and Currency formatting.
Filling tables with data
The table starts at the bottom of the first page and, depending on the amount of data, may flow on to the second page.
By setting the Table Properties in the template, you can control whether the whole table should start on a new page, or perhaps just repeat the header row on the next page.
You can find more details on this behavior in our blog called: Tips for Creating a Reporting Template.
Formatting dates and numbers
This template makes use of the built-in dateFormat and numFormat functions.
Date format function
In this example, the dateFormat function looks like this:
{dateFormat(date,'EEEE, dd MMM yyyy','MMddyyyy')}
The first parameter is the data item you want to format.
The second is a format string specifying how you want the date to appear in the document.
The third is a format string specifying how the date is encoded in the variable.
So the date from the data: 08112019, is displayed in the generated document as: Tuesday, 11 Aug 2019.
Number format function
In this example, the numFormat function looks like this:
{numFormat(number,'$#,##0.00')}
The first parameter is the data item you want to format.
The second is a format string specifying how you want the number to appear in the document.
In the example, number is formatted so that it:
- starts with a '$' sign
- has an optional comma at the thousands
- finishes with at least one number before the decimal point
- has two numbers after the decimal point.
So the number from the data: 1200, is displayed in the generated document as: $1,200.00.
You can find more details on the formatting options in the relevant Docmosis Template Guide.