| Chapter 3 Quick Start |
You can teach yourself how to use PTReportGen by choosing from the methods available in this section:
PTReportGen comes with Sample.mdb, a sample database you can use when learning the program. Sample.mdb is a Microsoft Access database. Virtually all of the examples in this manual are based on Sample.mdb data.
The sample reports access the sample database through the ODBC data source name "Report Sample". When you install PTReportGen, you can choose to add the ODBC data source name. And you also can add the ODBC data source name manually.
To create the System DSN "Report Sample", do as follows:
1. Click the Windows Start button, choose Settings, and then click Control Panel.
2. On computers running Microsoft Windows 2000 or later, double-click Administrative Tools, and then double-click Data Sources (ODBC). The ODBC Data Source Administrator dialog box appears. On computers running previous versions of Microsoft Windows, double-click 32-bit ODBC or ODBC.
3. Select the System DSN tab, and then press Add button.
4. Choose Microsoft Access Driver (*.mdb), then press Finish button.
5. In the ODBC Microsoft Access Setup dialog box, type Report Sample in the Data Source Name box.
6. Press the Select button, and browse to select Sample.mdb.
7. Press OK button to close the ODBC Microsoft Access Setup dialog box.
8. Press OK button to close the ODBC Data Source Administrator dialog box.
To create a report with PTReportGen, you should do as follows:
1. Prepare works
Before you create a report, you should determine the layout of the report, and know where and how to get the data.
You must know how to access the databases you are reporting from. So you need the data source name, user name and password. If you don't have added data sources, please add data sources first. Run ODBC Administrator, you can add a new data source. For detailed information about configuring ODBC, refer to ODBC Administrator Help.
2. Make a report template file
Create a report template file using Microsoft PowerPoint. The report template file is a Microsoft PowerPoint document. For detailed information about report template, refer to "Report Templates" in this document.
3. Create a PTR file
Create a PTR file with a .ptr extension using PTReportGen. There are tow steps to create a PTR file.
(1) Configure the report
Define the names of data sources, the name of the report template file, the name of the report file and the name of the log file. If you want to use parameters in SQL statements, define these parameters.
(2) Write functions
Write functions and SQL statements that specify how to get data from data sources and how to put data into the report.
For detailed information, refer to "Reporting with PTReportGen" in this document.
4. Run the PTR file
Run the PTR file to generate a report file. For detailed information about running report, refer to "Running a PTR File" in this document.
The following tutorial has been designed to guide you to create your first report. In this tutorial, you will get an introduction to the program as you create a Customer List report. The Customer List is one of the most basic business reports and typically has information such as Customer Name, City, Country, and Contact Name.
1. Run Microsoft PowerPoint, create a new presentation with a blank slide.
2. On the Insert menu, click Table. Select the number of columns and rows. Press OK button.
3. Click the cell A1, type "Customer Name". In the same way, you input "City", "Country" and "Contact Name" into the cells B1, C1 and D1.
4. Format the text of A1, B1, C1 and D1 as you like, including font, font size, font colour, bold, background, alignment and border.
5. You can change the width of these columns. The report template you have made is as follows:
6. Click Save on the File menu, chose a directory such as "C:\Report", type custlist.ppt in the File name box and press Save button.
7. Click Close on the File menu.
1. Run PTReportGen.
2. Click New on the File menu.
3. Click Save on the File menu, chose the directory to which you have saved the report template, type custlist.ptr in the File name box and press Save button.
1. On the Report menu, click Configuration. The Configuration dialog box appears.
2. Click the File tab.
In the Template File box, type custlist.ppt; In the Report File box, type Report\custlist.ppt; In the Log File box, type Log\custlist.log.
3. Click the Data Source tab.
Press New button, the New Data Source dialog box appears. In the Name box, type Report Sample, press OK button.
4. On the Configuration dialog box, press OK button.
In the editor windows, input a function as follows:
@F1=Report(slide=1 cell=A2) SELECT CompanyName ,CityName ,CountryName ,ContactName FROM Customers, Cities, Countries WHERE Customers.CityCode = Cities.CityCode AND Customers.CountryCode = Cities.CountryCode AND Customers.CountryCode = Countries.CountryCode AND CountryName = 'USA' ORDER BY CompanyName,CityName,CountryName ;
Please note the WHERE clause. It passes only records of customers in USA. You can test the SQL statement in a query tool such as Microsoft Access or Microsoft Query.
Before going any further, let us understand this function.
1. The Report function will execute the SQL statement, get data from data source, and put data into the report.
2. The slide argument identifies a slide, and the value 1 is the index number of the slide. So it is the first slide. You do not identify a table. So PTReportGen will put data into the first table in the slide.
3. The cell argument specifies the cells that the first record will be filled into. The value is A2. So PTReportGen will fetch the first record, put the value of CompanyName field into A2, the value of CityName field into B2, the value of CountryName field into C2, and the value of ContactName field into D2. An then it fetch the next record, put them into A3,B3,C3 and D3......
1. On the Report menu, click Run, the Run Report dialog box appears.
2. Press Start button to run the PTR file.
3. PTReportGen will generate a report.
4. After the status is Done, click Close button.
1. On the File menu, click Open Report File to open the report you have generated.
You can view and check the report.
2. On the File menu, click Open Log File to open the log file that recorded the log information in the report generating..
You can check the log.
3. Close the report file and the log file.
1. On the File menu, click Open Template File to open the report template.
2. Change the width of columns. It is very useful to copy some sample data from the report file into the report template for formatting.
3. Select the second row, and insert a row to the table.
4. Change the border width of the first row. Select the first row, click Table on the Format menu, and then click the Borders tab. Change the border width, and press OK button. The border of the first row is different from the border of the other rows. The report template you have made is as follows:
5. Save and close the template file.
In the editor windows, modify the function as follows:
@F1=Report(slide=1 cell=A2 pagebreak=12 reserve=2) SELECT CompanyName ,CityName ,CountryName ,ContactName FROM Customers, Cities, Countries WHERE Customers.CityCode = Cities.CityCode AND Customers.CountryCode = Cities.CountryCode AND Customers.CountryCode = Countries.CountryCode ORDER BY CompanyName,CityName,CountryName ;
1. The reserve argument specifies the number of records for that you reserve some rows. You have reserve two blank rows in the report template so that the format of the last row/column border may be different from the others.
2. The pagebreak argument specifies the number of records in one slide. You want a full customer list, and remove the specified condition in the WHERE clause. But a full customer list is too long in one slide. So you can put records into more slides using pagebreak argument. In this case, one slide contains 12 records.
1. Save the PTR file.
2. Run the PTR file to generate the report.
3. Open the report, view and check the report.
The report should now look similar to the following:
Now you have created a report.
After PTReportGen is installed, some sample reports are installed too. Use these reports to learn PTReportGen. The sample reports can be changed to adapt to your own needs.
The sample reports include a sample database, some report template files (.ppt) and PTR files (.ptr). They are located in the Application Data\LJZsoft under All Users or your profile folder.
| Directory | Description |
| {data}\Common\SampleDatabase | Contains the sample database "Sample.mdb". |
| {data}\PTReportGen\Samples | Contains the report template files (.ppt) and the PTR files (.ptr). |
| {data}\PTReportGen\Samples\Report | Contains the report files (.ppt) generated by PTReportGen. |
| {data}\PTReportGen\Samples\Log | Contains the log files created by PTReportGen during generating report files. |
{data} is the path of the data folder. You can select the data folder when you install PTReportGen. By default, the data folder is the Application Data\LJZsoft folder under All Users. If you install PTReportGen without administrative privileges, the data folder is the Application Data\LJZsoft folder under the current user. The data folder is usually at:
Windows 95/98: C:\windows\All Users\Application Data\LJZsoft
Windows NT: C:\WinNT\Profiles\All Users\Application Data\LJZsoft
Windows 2000/XP: C:\Documents and Settings\All Users\Application Data\LJZsoft
Windows Vista: C:\ProgramData\LJZsoft