How to Create a Custom Report

LogTen Pro gives you extreme flexibility in the types of pilot logbook reports you generate. Using the power of HTML, CSS, JavaScript, and virtually any other technology you can use in a web page you can create pretty much anything you can imagine. This article will walk you through creating your first template, and give you the tools you need to start creating whatever you need. Whether you want to add charts, and graphs, or need to track a specific type of flight time on your report, it’s all possible with LogTen Pro.

Getting Started

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.

Style

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.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 Report Components

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.

  • Page Row

    These will repeat for every row of the report.

Keys and telling LogTen Pro where to insert data

<?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 "Help" menu

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

Predicates

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.

Calculating Sums

@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 keypath=@sum.flight_totalTime ?> will give you a sum of total time for all flights that took place before the current location in the report.

Balance Forward

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.

Troubleshooting a Custom Report

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).

TextEditPreferencesCrop.png

  • 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 ?.

Conclusion

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.