Tinderbox is perfectly capable of exporting data tables in either Tab-delimited (TSV) or Commas Separated (CSV formats). Indeed, it is possible to use the same methods to export in formats like JSON It basically boils down to two aspects:
- Tinderbox data structure allowing export of per-note data as output rows.
- suitable templates.
The best way to achieve this is to export a container using its chid notes as the source of the data rows. Less usually, descendant notes can be used to provide part of the per-row data. Depending on the nature of the task and the layout of the document, it is possible to use either a standard container note, or an agent to provide the data source.
This process needs two templates. The first, used by the source container, sets the column headings for the table. These headings are generally set as literal strings. Thus for TSV ('[Tab] implies an otherwise invisible tab character, and [Return] a line return):
or as CSV:
In either case the template exports a set of 4 literal headers and than includes each of it's children in turn using the same template (which is different to this one)
For the children, assume the following. The 'Part' is the title of the note (thus, data from $Name). The 'Cost' will be from a user Number-type attribute ($Cost) and will need formatting as a number with two decimal places. The 'Number' will be taken from a user attribute 'Ordered' (so $Ordered). Lastly the line's 'Total' will be calculated as a number with two decimal places and based on the two preceding values.
First, in TSV form:
and in CSV form