JobDataCsv Class Reference

Provides access to JobDataCsv (a CSV-file that serves as JobData for a Job). More...

List of all members.

Public Member Functions

String getFilename ()
 Gets the filename.
char getQualifier ()
 Gets the Qualifier character that encloses DataField-values.
char getSeparator ()
 Gets the Separator character that separates DataField-names or DataField-values.
 JobDataCsv (String sFilename, char cSeparator, char cQualifier)
 Initializes a new instance of the JobDataCsv class.
 JobDataCsv ()
 Initializes a new instance of the JobDataCsv class.
void setFilename (String sFilename)
 Sets the filename.
void setQualifier (char cQualifier)
 Sets the Qualifier character that encloses DataField-values.
void setSeparator (char cSeparator)
 Sets the Separator character that separates DataField-names or DataField-values.


Detailed Description

Provides access to JobDataCsv (a CSV-file that serves as JobData for a Job).





The JobDataCsv enables TFORMer Runtime to use CSV-files (or more generic: any text file in a suitable format) as a JobData for printing a Job.

The data in such a file provides the values of the data-fields. Each line (except the first one - see below) is treated as a Record. TFORMer Runtime must match the values in the file with the corresponding DataField-names. Therefore the first row of the file must contain the DataField-names (see Name), separated by a Separator-character. All other rows contain the DataField-values, again separated by a Separator.

Each DataField-value or name may be enclosed in optional Qualifier-characters. This is useful if the Separator-character may be a part of a value.

The following example file contains 2 records.
The first line lists the DataField-names.
The comma (,) is used as Separator-character and the double quote (") is used as Qualifier-character:

Name/Value Separator Name/Value Separator Name/Value
"Email" , "JobTitle" , "Name"
"support@tec-it.com" , "Support Engineer" , "Mr. Harald Backoffice"
"sales@tec-it.com" , "Sales Assistant" , "Mrs. Susan Frontdesk"



Assume the sample file specified above is stored in C:/temp/Import.txt. The corresponding call to create the JobData and to assign it to a Job is as follows:

   // create a Job instance
   Job job = new Job();
   // create the data source
   JobDataCsv jobData = new JobDataCsv("c:/temp/Import.txt", ',', '"');
   
   job.setJobData(jobData);
   job.print ();



For a general description see JobData.


Constructor & Destructor Documentation

JobDataCsv ( String  sFilename,
char  cSeparator,
char  cQualifier 
)

Initializes a new instance of the JobDataCsv class.

Parameters:
sFilename The Filename.
cSeparator The Separator character.
cQualifier The Qualifier character ('\0' if no Qualifier should be used).


Member Function Documentation

String getFilename (  ) 

Gets the filename.

Returns:
The filename.

char getQualifier (  ) 

Gets the Qualifier character that encloses DataField-values.

Returns:
The Qualifier character that encloses DataField-values.

char getSeparator (  ) 

Gets the Separator character that separates DataField-names or DataField-values.

Returns:
The Separator character that separates DataField-names or DataField-values.

void setFilename ( String  sFilename  ) 

Sets the filename.



Parameters:
sFilename The filename.

void setQualifier ( char  cQualifier  ) 

Sets the Qualifier character that encloses DataField-values.


The default qualifier is the double quote ("). To disable the use of a Qualifier set this property to '\0' (datasource.Qualifier = '\0';).

Parameters:
cQualifier The Qualifier character that encloses DataField-values.

void setSeparator ( char  cSeparator  ) 

Sets the Separator character that separates DataField-names or DataField-values.


Parameters:
cSeparator The separator character that separates DataField-names or DataField-values.


© 2006-2009 All rights reserved by TEC-IT Datenverarbeitung GmbH
Generated on Wed Sep 2 16:01:27 2009 for TFORMer Runtime JAVA Developer Reference with doxygen 1.5.8