Form-based Reporting

This topic introduces developers to form-based reporting using templates, which delivers highly-formatted reports generated using Logi Info, via a web browser.

About Form-based Reporting

Form-based reporting is a special technique in which developers create forms, or templates, with specific regions designated in them for data. At runtime, the Logi Server Engine retrieves data and fills-in the specified data regions, leaving all the other report layout and formatting information unaffected. Examples of popular implementations of this technique include the generation of employment applications, tax forms, health care forms, and invoices. The final content generated must accurately render the form and the data without distortion or other formatting changes.

Form-based reporting differs from web-based reporting in the way developers use Logi Info. For web-based reports, developers use Logi Studio as the design front-end and the data and report layout are built using report definitions.

However, for form-based reporting, other vendors' tools are used to create the actual output document layout, or template file. Logi Studio is then used to develop the data retrieval and data population scheme. To facilitate this, Logi Info provides templatedefinitions which are "blueprints" that indicate how data is mapped into the appropriate regions in a document.

Template files create with other vendor's tools are typically stored in the _SupportFiles folder but may be stored in any custom folder that you might want to create within your application root folder. Logi Template definitions are stored in the application's _Definitions/_Templates folder. In Logi Studio, these definitions appear in a separate Templates folder in the Application Panel.

Adobe PDF Templates

The Adobe Portable Document Format (PDF) is an industry standard for highly-formatted reports and documents. You can create PDF templates using any standard PDF editing tool. A PDF template includes editable form fields as well as static information such as graphics, text, bar-coding and boilerplate information.  

The image above shows an empty PDF form template for an invoice. The locations of the form fields within the template determine the placement and appearance of the data in the final document. You can define and format text and numeric information on the form, as well as present data in a fixed tabular form.  

Back to top

Microsoft Excel Templates

Business analysts work with Excel worksheets every day to build highly-formatted reports. You use Microsoft Excel as the design front-end for building Excel template files. The Logi server engine fills-in the empty Excel template with data from one or more data sources.  

The image above shows an Excel template for synthetic rating estimation, based on firm type, earnings and expenses. Charts, formulas, and pivot tables are dynamically updated based on the data contained in the worksheet. Templates are not restricted to one worksheet; a single report template can contain one or more worksheets within a workbook. You can also specify whether the final document contains one filled template or multiple filled templates by toggling an attribute within the Logi Template definition.

Back to top

Microsoft Word Templates

Microsoft Word can also be used to design document templates and, as with Excel templates, the Logi server engine fills-in the empty template with data from one or more data sources.

The image above shows part of a Word report template for adverse health care event information. The fields on the form template are filled-in by the Logi server engine and then the Word document can be processed like other templates: returned to the user's browser, saved, emailed, etc.

Back to top

The Template Definition

Logi Studio provides a special category of definition file, the Template definition, for use with form-based reporting. A Logi Template definition references a PDF, Excel, or Word template file (the target), specifies one or more datasource queries, and specifies how the target template is to be filled-in.

At runtime, the Logi Server Engine fills the data regions specified in the target template with data values and generates a new output document of the specified type. Developers control the delivery mechanism for the new document (e.g. return to the browser, save on the server, embed in an email, etc.).

In a Logi application, template definitions are stored in the _Definitions/_Templates folder. In Studio, they appear beneath a Templates folder in the Application panel. Each template definition includes elements that are specific to the document type being generated and they're used to map the data into the native document template. The details of creating Template definitions are discussed in separate DevNet topics specific to each document type.

Using Template Definitions

Two approaches are available for using Template definitions to product a document:

  • In a Logi Info Report definition, the document is generated and returned to the user's web browser.
  • In a Logi Info Process definition, a task saves the generated document as a file on the web server. 

In the first approach, the Action.Template and Target.Template elements are used to reference template definitions:  

The example above shows these elements in a Report Definition; they cause the "Invoice" template definition to be used to fill-in and generate the desired document. By default, the document is given a randomly-generated, GUID-based filename and is temporarily stored in the application's rdDownload folder, and then returned to the user's web browser to be viewed immediately, or saved locally. If a fully-qualified path and filename is specified for the Export Filename attribute, the document will be stored as that file on the web server, and then returned to the user's web browser to be viewed immediately, or saved locally. Examples of valid file names are:

@Function.AppPhysicalPath~\Exports\Invoices.xlsx
C:\inetpub\wwwroot\MyLogiApp\MyTemplateDocs\FormLetters.xlsx

Naturally, the account used to run your Logi application must have full File Access permissions to any folder that will contain saved documents.  

In the second approach, the Procedure.SaveTemplate and Target.Template elements are used in a Process task:

The example above shows a Process Definition task; it also causes the "Invoice" template definition to be used to fill-in and generate a document. However, in this case, the document is saved as a file, using the fully-qualified path and filename specified, and is not automatically returned to the user's web browser for viewing. Using other elements, you can then work with the saved file, perhaps linking it to the browser or sending it out in an email. Examples of valid file names are the same as those shown above and File Access permissions must be in place as discussed previously.

Templates provide a powerful reporting mechanism and Logi reporting products provide a number of ways of generating and distributing them. For additional information about specific type of templates, see our other Template documents.

Back to top

Debugging Templates

Special debugging features make it easier for you to determine what happens when a template is filled. These debugging features are enabled if you have the report's debugging style set to Debugger Links, either from Studio's toolbar or by manually configuring in it the _Settings definition.

For Excel templates, a debugging link, as shown above, will be displayed in the template. Clicking this link will display a typical Debugger Trace page, with details of the template operation.

For Word and PDF templates, no such link will be displayed. However, a file with the debug information will be saved, and you can browse it directly. The filename will be:

yourLogiAppfolder/rdDownload/GUID + templateName-rdDebug.htm

Back to top