Skip navigation links
The powerful and versatile time tracking system!
Menu
TimeTraces
The powerful and versatile time tracking system!

Report template specification

Introduction

TimeTraces comes with several report templates pre-installed.  The available templates are described on the Report look and layout page.  You can customize these existing report templates or create new report templates for yourself.  The report templates are installed in the "Report templates" subfolder in the TimeTraces application folder (most commonly located at "C:\Program Files\TimeTraces\Report templates").  The report templates are translated in all supported languages; each language's set of templates are located in its own subfolder.  When you want to use additional report templates you have to place them in these folders.

Report templates consist of two files; a settings file and a content file.  The settings file must have the ".ttr" extension; you are however free to name the content file as you like.

The templates that are located in the report template folder are presented as possible choices in the "Generate report" window.  Included with the help pages are also some sample templates you can base your own templates on.  You can find these in your TimeTraces application installation folder in the subfolder "Help\EN\Report samples".  They show you how to work with the different file formats, but they will probably need customization to fit your needs.

Report settings file

The report settings file is a regular Windows INI file.  It needs to have a section called "[Settings]", in which all settings are listed.  All settings need to be specified.  The available settings are:

Categorization The list of (sub)categories the template is listed under in the template selection tree in the "Generate report" window.  The (sub)categories in the categorization need to be separated by a single backslash (\).  The number of subcategories is limitless.  You are free to re-use existing (sub)category names, but you can also use new ones.
Description A description of the template that is shown when the template is selected in the "Generate report" window.
Format The format with which to write out the data. . Use the correct setting for the desired output format.
FileNameType Name of the type of file this report template creates.  This name will be used when browsing for a destination file in the "Generate report" window.
DefaultExtension The default extension for the type of file this report template creates.  This extension will be used when browsing for a destination file in the "Generate report" window.
ContentFile The file name of the file containing the content template of the report.  There are no restrictions on this file name.

The used report format encoding dictates how the data will be written out.  The data will be processed and/or encoded to fit the desired output format when needed.  The available formats are:

csv Comma separated value
tab Tab delimited
html HTML
xml XML
txt Plain text
rtf Rich text format

Report content template file

The content of the report will be built up dynamically by filling in tags and tag sections in the report content template.  All tags are placed between "[#" and "#]" marks, like [#tagname#].  Tags are case sensitive and whitespace is not allowed in them.  There are a couple of groups of tags you can use.

Some tags form tag sections.  These are used for writing out all the activities, time periods and time values in the report.  These sections are used to mark an entire block of content to be filled in repeatedly for each item in the set they represent; they thus enable you to e.g. list all used activities and write out the time values as a table.  Section tag names end with "startsection" and "endsection" and must be used in pairs.

There are several modes in which activities and time period sections will write out their items.  This is denoted by writing the mode after the section start name between "(" and ")" characters, like [#activity_startsection(user)#].  The available modes per tag are mentioned in the documentation for the tag by listing all modes between "(" and ")", like "(all, user, used)".  The following modes are recognized:

all Include all items in the section.
used Only include the items on which time is registered.
user Only include the items on which time is registered or when the user wants to see empty items.
used_insection Only include the items on which time is registered in the current top level section item (used for nested sections).
user_insection Only include the items on which time is registered in the current top level section item or when the user wants to see empty items (used for nested sections).

The "user" and "user_insection" versions reflect the user's choice; he can opt to not include empty activities and/or empty time periods in the "Generate report" window (the report options "Include empty activities" and "Include empty time periods").

Another distinction exists between "(roundsum)" and "(sumround)" tag modes; this is indicated by "(roundsum, sumround)".  There is a difference in the final result between rounding values before summing them up versus summing up values and then rounding the result.  Both versions are useful in reports.  The "(roundsum)" mode represents results that are summed over rounded values, and the "(sumround)" mode represents results that are rounded after summing the values.

A tag or tag pair can occur more than one time in the content template.  Every occurrence will be filled in independently, which allows you to e.g. create both a header and a footer row using the same "activities" section tag pair.

Report options tags

The available report option tags are:

[#reportoption_statisticsper#] The "statistics per" option in the "Data handling" section in the "Generate report" window.  The possible values are: "hour", "day", "week", "month", "year" and "total project".
[#reportoption_roundingby#] The "Round off to" option in the "Data handling" section in the "Generate report" window.  The possible values are: "second", "minute", "6 minutes", "quarter of an hour", "half hour" and "hour".
[#reportoption_dataformat#] The "Format" option in the "Data handling" section in the "Generate report" window.  The possible values are: "numeric hours", "numeric days" and "time".

Project details tags

Available project detail tags are:

[#project_name#] The name of the project.
[#project_filename#] The file name of the project.
[#project_filepath#] The total file path of the project.

Time period details tags

The chosen time period for the report is divided into discrete separate sub time periods according to the "Statistics per" reporting option.  The tags for the details on these sub time period periods are:

[#timeperiod_firststart(all, used, user)#] The start of the first sub time period in the reporting time period.
[#timeperiod_lastend(all, used, user)#] The end of the last sub time period in the reporting time period.

Report total time tags

The total time registered in the report is available via the tags:

[#report_totaltime(roundsum, sumround)#] The total cumulative time registered in the report.

Report activities tags

The set of activities can be written out by a tag pair.  The tag pair is:

[#activity_startsection(all, used, user)#] The start of the activity section.
[#activity_endsection#] The end of the activity section.

Within an activity section you can write out the activity's characteristics via the following tags:

[#activity_name#] The name of the activity.
[#activity_path#] The total path of the activity.
[#activity_nr#] The sequence number of the activity in the set.
[#activity_id#] The activity's unique ID in this report.
[#activity_totaltime(roundsum, sumround)#] The total time registered on the activity.

Within an activity section you can also write out the details of each time period via the following tag pair:

[#activity_timeperiod_startsection(all, used, used_insection, user, user_insection)#] The start of the time period section.
[#activity_timeperiod_endsection#] The end of the time period section.

Within an activity time period section you can write out the details of that time period and the time registered on that activity in that time period via the following tags:

[#activity_timeperiod_time#] The time per activity per time period.
[#activity_timeperiod_start#] The start date/time of the time period.
[#activity_timeperiod_end#] The end date/time of the time period.
[#activity_timeperiod_nr#] The sequence number of the time period in the set.
[#activity_timeperiod_id#] The time period's unique ID in this report.
[#activity_timeperiod_totaltime(roundsum, sumround)#] The total time registered on the time period.

Report time periods tags

The set of time periods can be written out by a tag pair.  The tag pair is:

[#timeperiod_startsection(all, used, user)#] The start of the time period section.
[#timeperiod_endsection#] The end of the time period section.

Within a time period section you can write out the time period's characteristics via the following tags:

[#timeperiod_start#] The start date/time of the time period.
[#timeperiod_end#] The end date/time of the time period.
[#timeperiod_nr#] The sequence number of the time period in the set.
[#timeperiod_id#] The time period's unique ID in this report.
[#timeperiod_totaltime(roundsum, sumround)#] The total time registered on the time period.

Within a time period section you can also write out the details of each activity via the following tag pair:

[#timeperiod_activity_startsection(all, used, used_insection, user, user_insection)#] The start of the activity section.
[#timeperiod_activity_endsection#] The end of the activity section.

Within a time period activity section you can write out the details of that activity and the time registered in that time period on that activity via the following tags:

[#timeperiod_activity_time#] The time per time period per activity.
[#timeperiod_activity_name#] The name of the activity.
[#timeperiod_activity_path#] The total path of the activity.
[#timeperiod_activity_nr#] The sequence number of the activity in the set.
[#timeperiod_activity_id#] The activity's unique ID in this report.
[#timeperiod_activity_totaltime(roundsum, sumround)#] The total time registered on the activity.

Report content tag usage examples

The above information is a bit abstract, so here is an example to help you on your way.  The template below writes out a CSV data file.

Line 1 Start,End[#activity_startsection(user)#],[#activity_path#][#activity_endsection#],Total time[#timeperiod_startsection(user)#]
Line 2 [#timeperiod_start#],[#timeperiod_end#][#timeperiod_activity_startsection(user)#],[#timeperiod_activity_time#][#timeperiod_activity_endsection#],[#timeperiod_totaltime(roundsum)#][#timeperiod_endsection#]
  • We need to list both a header line containing the activities and the time data grid for each time period.  The first objective is performed using the [#activity_startsection(user)#] tag, and the second objective via the [#timeperiod_startsection(user)#] tag.
  • The "Start,End" at the start of the template forms the headers for the start- and end date/time of the time periods in the rows.
  • Immediately following that is the [#activity_startsection(user)#] and [#activity_endsection#] tag pair that writes out all activities in the report.  This composes the part of the header including the activity details.
    • Note that a comma leads the details in this section; this way each entry is separated by a comma (as is required by the CSV format).
    • Since each activity has a preceding comma, you do not explicitly have to separate the "End" header from the first activity.
    • Each activity is represented by its path via the [#activity_path#] tag.
  • After the activity header has been build up we include the final "Total time" header, preceded with a comma to separate it from the last activity.
  • Because each row in a CSV file needs to be on its own line, and because empty rows are unwanted in CSV files, you have to include exactly one line ending between the [#timeperiod_startsection(user)#] and [#timeperiod_endsection#] tags.  Since the first data row needs to be separated from the header anyway, it is best to use the line ending at the end of the header for this.  On the same line following the header is thus the [#timeperiod_startsection(user)#] tag with nothing but the line ending following it.
  • Each data row is preceded with the start- and the end date/time of the time period representing the row.  This is done via the [#timeperiod_start#] and [#timeperiod_end#] tags.  They need to be separated with a comma.
  • Following the row header is the time data.  This is done the same way as the header was build up, now using the [#timeperiod_activity_startsection(user)#] and [#timeperiod_activity_endsection#] tag pair instead.  Each time value is written out by the [#timeperiod_activity_time(roundsum)#] tag.

General notes

  • Since you need to insert a tag section's start- and end tags right where you must write out the report sections, it might not be possible to edit some template in all editors.  An example is a HTML formatted report in which you want to build up a table containing the time periods on the rows.  In this case the start- and end tags writing out the rows should be placed around the HTML row tags (<tr> and </tr>), but within the <table> tag.  This is however illegal in HTML; arbitrary text between these tags is not allowed.  You could still use an HTML editor to set up the look and feel of the template, but you need a plain text editor like Notepad to finally insert the section start- and end tags.
  • The tag names are case sensitive and do not allow whitespace in them.  Unrecognized tags are not processed.
  • When you modify an existing report template, it will be overwritten when you install a newer version of TimeTraces.  In order to preserve your modifications it is best to create a copy of the template you wish to modify and modify the copy instead.  Do not forget to specify a new name for your copy, otherwise it and its original will be indistinguishable in the "Report template" choice.
  • When you make a portable installation of TimeTraces that includes report templates, all files in the "Report templates" subfolder will be copied.
  • The table layout format in the RTF specification is quite difficult to reconcile with dynamically building up a table via template substitution.  The reason for this is that you have to define the absolute position of the right edge of each table cell individually (using the \cellx command).  When using tables in RTF you can best limit the dynamic expansion to the rows only, and keep a fixed number of predefined columns.  The columns can of course still contain single template parameters.  If you want to dynamically add columns via the template, your best option is to use the "activity_nr" or "timeperiod_nr" tags to create increasing column end positions (in multiples of 100 e.g. by using "\cellx[#activity_nr#]00").
  • If you plan on writing RTF templates, you are (at least initially) advised to save your templates via WordPad and not Microsoft Word.  WordPad uses a far smaller subset of the RTF specification which vastly reduces the generated RTF complexity and size.  The templates created this way are still fully compatible with Microsoft Word.