JobDataDataSource class
Namespace: TECIT.TFORMer
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.RepositoryName = "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.ParameterValues.Add ("PickingListParameter", "2");
// Assign the JobData to the Job
printJob.JobData = jobData;
// Select PDF output to /temp/out.pdf
printJob.OutputName = "/temp/out.pdf";
printJob.PrinterType = PrinterType.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
Inherited members (2)
Constructors
| Member | Description |
|---|---|
| JobDataDataSource() | Constructor for JobDataDataSource. |
| JobDataDataSource(string) | Constructor for JobDataDataSource. |
Properties
| Member | Description |
|---|---|
| Name | Gets/Sets the name of the DataSource. |
| ParameterValues | Gets/Sets the values for DataSourceParameters. |