DataSourceCsv class

Namespace: TECIT.TFORMer

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.GlobalProject;

  // 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.Qualifier = "'";
  dataSource.Separator = ",";  

Base types: DataSource

Inherited members (27)

Properties

MemberDescription
Filenamestring { get; set; }

Gets/Sets the filename of the CSV file.

HasColumnNamesbool { get; set; }

Gets/Sets if the DataSourceCsv expects column names in the first line of the CSV file.

Qualifierstring { get; set; }

Gets/Sets the qualifier character that encloses DataField values.

Separatorstring { get; set; }

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

Methods

MemberDescription
ToString()override · Returns: string

Returns a string representation of the instance.

Search documentation

Search in
More scopes
Additional scopes

All contents