JobDataRecordSet class
Package: com.tecit.TFORMer.Printing
Provides access to JobDataRecordSet (a set of in-memory Record objects which serves as JobData for a Job).
Usage and notes
Overview
The JobDataRecordSet is the preferred method to pass data to TFORMer SDK from within program code. Create and fill a JobDataRecordSet and pass it to the Job using JobData.
The JobDataRecordSet represents an in-memory list of Records. Each Record holds a collection of pairs of strings. The first member of such a string-pair denotes the name of the DataField, the second member denotes the value of the DataField.
Although not required it is good practice to set all DataFields used in the FormLayout for each Record. If a DataField used in the FormLayout is not supplied for a Record, its value depends on JobData.setReuseValues.
By default each Record is used for printing exactly once. This behavior can be changed with setNumberOfCopies.
Example
This example provides 2 records. It sets the values for the DataFields ArticleNo, ArticleName and ArticlePrice. The second record will be printed two times.
// Create a new Job instance
Job printJob = new Job();
// Select the FormLayout (stand-alone or Repository-based)
// ...
// Create a new JobData instance.
// Here we are using the JobDataRecordSet which accepts Records containing name/value pairs
JobDataRecordSet jobData = new JobDataRecordSet();
// Create a new Record
JobDataRecordSet.Record record = new JobDataRecordSet.Record();
// Populate the Record with key/value pairs to define the DataField values
record.setData("ArticleName", "Speaker System HF1");
record.setData("ArticleNo", "12001234");
record.setData("ArticlePrice", "498.98");
// Add the Record to the JobData
jobData.add(record);
// Create a second Record
record = new JobDataRecordSet.Record();
// This Record should be printed two times
record.setNumberOfCopies(2);
record.setData("ArticleName", "Record Box 12 CDs");
record.setData("ArticleNo", "12021231");
record.setData("ArticlePrice", "8.85");
jobData.add(record);
// 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 ();
More Information
For a general description see JobData.
Note
Thread-safety: A single instance of this class must not be used by different threads.
Inheritance and related types
Base types: JobData
Nested types: com.tecit.TFORMer.Printing.JobDataRecordSet.Record
Inherited members (4)
Constructors
| Member | Description |
|---|---|
| JobDataRecordSet() | Constructor for JobDataRecordSet. |
Methods
| Member | Description |
|---|---|
| add(Record) | Adds the Record. |
| getRecords() | Gets an Record iterator. |