DataSourceCsv class

Package: com.tecit.TFORMer.Repository

Specialized DataSource for CSV data (character separated values).

Usage and notes

Overview

DataSourceCsv is a specialized DataSource for importing data from CSV files.
This class is used to manipulate existing DataSourceCsv objects. To create a new DataSource use TFORMer Designer or Project.addDataSource.

The main properties to characterize a DataSourceCsv are:

  • The filename

  • The separator character
    This is usually a comma , and separates the single column names (= the names of the DataFields) and column values (= values of DataFields) from each other

  • The qualifier character
    The qualifier character encloses column-values (e.g. "This is a string").

  • Has column names
    Specifies if the CSV file contains the DataField names in the first line. If no names are provided TFORMer assumes the names Field_0, Field_1, etc.

Modifying an Existing CSV-DataSource

  // Retrieve the global Project
  // DataSources are defined in a Project or a global Project
  Project project = repository.getGlobalProject ();

  // Retrieve the DataSource by name
  // Since we know the type of the DataSource, we can cast it to DataSourceCsv
  DataSourceCsv dataSource = (DataSourceCsv)project.getDataSource("CSV");

  // Modify some DataSource properties  
  dataSource.setQualifier("'");
  dataSource.setSeparator(",");

Base types: DataSource

Inherited members (33)

Methods

MemberDescription
dump(PrintStream)Returns: void

Dumps the current instance into a text stream.

getFilename()Returns: String

Gets the filename of the CSV file.

getQualifier()Returns: String

Gets the qualifier character that encloses DataField values.

getSeparator()Returns: String

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

isHasColumnNames()Returns: boolean

Determines if the DataSourceCsv expects column names in the first line of the CSV file.

setFilename(String)Returns: void

Sets the filename of the CSV file.

setHasColumnNames(boolean)Returns: void

Sets the HasColumnNames of the DataSourceCsv.

setQualifier(String)Returns: void

Sets the qualifier character that encloses DataField values.

setSeparator(String)Returns: void

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

Search documentation

Search in
More scopes
Additional scopes

All contents