TFORMer SDK - JAVA
8
|
The JobDataOdbc enables TFORMer SDK to use arbitrary database-tables or queries as JobData for printing a Job.
The data in such a table provides the values of the DataFields. The table is read Record by Record using the specified SQL SELECT statement. TFORMer SDK matches the column-names of the table or query with the corresponding DataField names in the FormLayout. If required use SQL aliases to provide identical column names.
The order of the columns in the table or query does not matter.
The DSN represents the name of the database connection as defined in the Microsoft Windows Control Panel. Please keep in mind that the DSN is a part of the connection string and thus a complete specification is required.
This may yield the following code:
// Set the DSN programmatically jobDataOdbc.setDsn("DSN=TFORMer_Sample");
This example demonstrates how to use the pre-installed ODBC data-source (named TFORMer_Sample) for generating a report as PDF. The table tbl_Example looks like follows:
ChapterNumber | Caption | PageNumber |
---|---|---|
1 | Content | 2 |
1.1 | Table of Figures | 6 |
1.2 | List of Tables | 6 |
2 | Disclaimer | 7 |
... | ... | ... |
This is the code to use this table as a JobDataOdbc:
// Create a new Job instance Job printJob = new Job(); // Select the stand-alone FormLayout named ODBCReportPDF.tff // This FormLayout is usually installed as part of the TFORMer Examples in // - Windows Vista or later: C:/Program Data/TEC-IT/TFORMer/8/Examples // - Older Microsoft Windows versions: C:/Documents and Settings/All Users/Application Data/TEC-IT/TFORMer/8/Examples printJob.setRepositoryName("C:/Documents and Settings/All Users/Application Data/TEC-IT/TFORMer/8/Examples/Command Line/ODBCReportPDF/ODBCReportPDF.tff"); // Create a new JobData instance using the installed sample ODBC connection named TFORMer_Sample JobData jobData = new JobDataOdbc("DSN=TFORMer_Sample", "", "", "SELECT FROM tbl_Example"); // Assign the JobData to the Job printJob.setJobData(jobData); // Select PDF output to /temp/out.pdf printJob.setOutputName ("/temp/out.pdf"); printJob.setPrinterType (EPrinterType.PDFFile); // Generate output based on the FormLayout and the JobData printJob.print ();
For a general description see JobData.
© 2006-2024 - all rights reserved by TEC-IT Datenverarbeitung GmbH | |
Generated on Thu Oct 3 2024 05:08:23 for TFORMer SDK - JAVA with doxygen 1.7.6.1 |