JobDataDataSource class

Package: com.tecit.TFORMer.Printing

Provides access to a user-defined DataSource, which is defined in the FormLayout or a Repository.

Usage and notes

Overview

A data source defined for a FormLayout supplies input records for generating output. Use JobDataDataSource to supply this data source as the JobData of a Job.

The creator of a FormLayout is able to define such a DataSource with TFORMer Designer. This DataSource definition is stored as part of the FormLayout and is identified by a unique name. It defines how data is retrieved (e.g. from an ODBC database), the field-mappings and optional DataSourceParameters.

If you specify no or an empty name when using the JobDataDataSource, TFORMer SDK uses the DataSource selected in the FormLayout. This need not be the special _Default_ source.

The _Default_ source reads the DataField values saved by TFORMer Designer alongside the layout in its companion .xml file. The SDK also falls back to that file when no source is selected in the layout. If this file supplies the input and is absent, its saved records are not available for output.

The optional DataSourceParameters can change settings such as the input filename, SQL SELECT statement or ODBC DSN at runtime.

Examples

The following example selects a data source defined in the form layout, sets a data source parameter, and generates a PDF file.

  // Create a new Job instance
  Job printJob = new Job();

  // Select the stand-alone FormLayout named (6) Samples_Picking List.tff
  // This FormLayout is usually installed as part of TFORMer in
  // - Windows Vista or later: C:/Program Data/TEC-IT/TFORMer/9/Templates
  // - Older versions of Microsoft Windows: C:/Documents and Settings/All Users/Application Data/TEC-IT/TFORMer/9/Templates
  printJob.setRepositoryName ("C:/Documents and Settings/All Users/Application Data/TEC-IT/TFORMer/9/Templates/(6) Samples_Picking List.tff");

  // Create a new JobData instance using the DataSource named "ODBC" defined inside the Formlayout
  JobDataDataSource jobData = new JobDataDataSource("ODBC");

  // Specify any DataSourceParameters
  jobData.setParameterValue ("PickingListParameter", "2");

  // 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.

Base types: JobData

Inherited members (4)

Constructors

MemberDescription
JobDataDataSource()

Constructor for JobDataDataSource.

JobDataDataSource(String)

Constructor for JobDataDataSource.

Methods

MemberDescription
getName()Returns: String

Gets the name of the datasource.

setName(String)Returns: void

Sets the name of the datasource.

setParameterValue(String, String)Returns: void

Sets the values for DataSourceParameters.

Search documentation

Search in
More scopes
Additional scopes

All contents