We are moving to our new home. Several online services will be unavailable from
Saturday, December 16th to Sunday, December 17th.   |   More information

Inductive Automation
News Room

News / April 04, 2007

How To: Turn An Existing PDF Into A Dynamic Report

This article demonstrates how to use the FactoryPMI Reporting Plugin to dynamically fill an existing PDF report. For this example, we will fill in a 1040EZ Income Tax Return with data from a MySQL database.

Background


The database we are using for this example is called Accounting. There are two tables inside the database, one called Contacts and one called Income.

The contacts data can be retrieved from the accounting database with the following SQL query:
SELECT C.* FROM Contacts C ORDER BY C.ID;


The income data can be retrieved from the accounting database with the following SQL query:
SELECT I.* FROM Income I ORDER BY I.ContactID;


You can retrieve the combined data for the first contact with the following query:
SELECT C.*, I.* FROM Contacts C, Income I WHERE C.ID = I.ContactID AND C.ID = 1;

Getting Started

Begin by installing the Reporting Plugin in the FactoryPMI Gateway Configuration under the section labeled Plugins. Once you have the plugin installed open up the FactoryPMI Designer and select the project you want to configure. Now create a new window and drag down a Report Viewer from the Reporting tab. Next, populate the Data dynamic dataset property by binding it to the combined sql query from the last section. Now click on the Customizer (Cntl+U) button to start designing the report.



Creating the Report

First drag and drop an existing PDF from Windows into your report designer. This will make the existing PDF the background of your report.



Now, select the Keys tab on the right hand side of the report designer. Next, select Data and then drag and drop the Firstname key into the report. It is as simple as that!



Finish dragging in all of the keys for the report. You can even do dynamic calculations inside the report as well. Once you are done click OK and the report will look like this:



Learn more about the FactoryPMI Reporting Plugin