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

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.

Here's how to get to the reports folder:

LogTen Pro 6

Report templates can be located by going to the Help->Show Custom Reports Folder option.

LogTen Pro 5 and earlier

Report templates in LogTen Pro live in a special folder in your “home” folder, located at ~/Library/Application Support/LogTen Pro/

If you are running Lion, the library folder has been hidden and you will need to hit Command+Shift+G from the Finder to bring up the Go to Location window, then paste in the path above.

Style

For each report template there is Cascading Style Sheet (CSS) file called “style.css”. In this file you specify the report type, name, description, author, version, number or rows per page, etc. AND here is 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, it’s 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.

The Report Components

The various report styles, such as one page, two page, totals, have slights 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 occur for every row of the report.

Keys and telling LTP 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 in the Help->Show Available Report Keys menu

In addition to the key itself, there are a few other optional additions:

dateFormat="MM/dd/yyyy"; -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 there is PIC time on the flight as well.

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

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.

Conclusion

With only a rudimentary knowledge of HTML and CSS you can create powerful custom reports. Browse the other help articles in the reports category for detailed instructions on accomplishing specific tasks.