How to Create a Custom Report
First, open the Reports folder in LogTen Pro's main navigation bar, by going to the "Help" menu and selecting "Show Custom Reports Folder".
In the reports folder you will find two important folders, “Sample Report Templates” and “My Report Templates”. LogTen Pro will look for your template in the “My Report Templates” folder, so the easiest way to start a new template is to copy one from the “Sample Report Templates” folder into the “My Report Templates” folder.
For each report template there is a Cascading Style Sheet (CSS) file called “style.css”. In this file you specify the report type, name, description, author, version, number of rows per page, etc. AND this is also where you define all the styles that apply to the report. This means you can affect numerous things, including colours, column widths, fonts, sizes, etc.
Going into the details of working with CSS, its rules, formats, and capabilities is beyond the scope of this document, however there are numerous references online, that should help you if you are unfamiliar with it. Many things should be fairly obvious simply by browsing the style.css file.
Note that since many reports share common styles, you may want to look in the Tools folder at the coradineBaseStyle_v2.css file. All reports include this style, so you can override any style by simply adding the same style to your reports style.css file and changing the parameters.
The various report styles, such as one page, two page, totals, have slightly different sets of HTML files, however they are very similar. Primarily they will consist of:
Document Header and Footer
These will occur only once for the whole report, the header at the beginning, and the footer at the end.
Page Header and Footer
These will occur once for each page of the report, the header at the beginning, and the footer at the end.
These will repeat for every row of the report.
<?ltp keypath=xxx; ?>
Within each of the files are keys for LogTen Pro where data is to be inserted. Each marker looks like
<?ltp keypath=xxx; ?> and has a key ("flight_totalTime" for example) that LTP uses to replace with data from the current flight as it builds the report, for example every time LTP comes across this:
<?ltp keypath=flight_totalTime; ?> it will replace it with the total time for the current flight it's inserting.
A complete list of report keys is available by selecting "Display Available Report Keys" from the "Window" menu on the Mac version of LogTen Pro
In addition to the key itself, there are a few other optional additions:
Date and Time Formats
dateFormat="MM/dd/yyyy HHmm"; -For any items that are a time or a date, you can customize the format. For a complete list of available formats, go here: http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns
predicate="flight_totalTime > 0"; -This is a logical statement that will only replace the main keypath with a value if the predicate returns true, for example
<?ltp keypath=flight_totalTime; predicate="flight_PIC > 0"; ?> will show the total time for a given flight, but only if the flight's PIC time is greater than zero.
@sum -This is used in front of a keypath to indicate that you want the sum of the key rather than the value from an individual flight.
<?ltp firstname.lastname@example.org_totalTime ?> will give you a sum of total time for all flights that took place before the current location in the report.
scope="forward"; -This is an optional addition when you are working with a key that has an '@sum.' in it, "page" will give you the total for the current page, "forward" will give you a balance forward total or a carry forward total, depending on if it's at the top or the bottom of the report page.
There are a variety of reasons that can make a custom report not appear as it should. The following is a list of some of the issues that can occur.
Smart Quotes, when used causes the edited section to be unrecognizable. These turn the straight up and down quotes into curly ones. See the following for an example of each:
"Regular quotes" “Smart quotes”
This is turned on by default in TextEdit and will alter the text after you type it, so be sure it is turned off if you're using TextEdit or similar program (see following image).
Spacing in LogTen Pro's markdown needs to stay consistent with the surrounding code. If the spacing changes, it can cause a section to not appear as it should. See the following example of good and bad spacing:
- Good: <?ltp keypath=flight_selectedCrewSIC; ?>
- Bad: <?ltp keypath= flight_selectedCrewSIC;?>
The good spacing is consistent with other markdown used in the report. The bad spacing won't be interpreted correctly because there is a space following the = sign and there is no space between the ; and the ?.
There was a general overhaul of the reports with 7.4. The biggest change was that some kinds of summary reports did not have the capability to retrieve past time values. If you added
@sum.flight_totalTime in a logbook report, you would get the entire Total Time for the logbook (up to the last entry in the report) regardless of whether the report was generated for the last 4 years or the last 4 days. The same
@sum.flight_totalTime in a summary report would either give you the last 4 years, or the last 4 days.
To accommodate this ability in the new system,
scope=report; was added. It retrieves the last 4 years or last 4 days in these examples, and a scope-less
@sum.flight_totalTime retrieves all Total Time from the entire logbook.
With only a rudimentary knowledge of HTML and CSS you can create powerful custom reports. Check out our article How to Change a Column and Font in a Custom Report for detailed instructions on accomplishing these tasks.