Write CSV File

Operation Name

Write CSV File

Function overview

Write input data to CSV (Comma Separated Value) format, or TSV (Tab Separated Values) format file.

Data model

Data model of this type of component is table model type.

Properties

For information about using variables, refer to "variables".
Basic setting
Item name Required / Optional Use of Variables Description Remarks
Name Required Not available Enter the name on the script canvas.  
Input data Required Not available Select the component on the script canvas.  
Required settings
Item name Required / Optional Use of Variables Description Remarks
File Required Available Input file path of CSV format or TSV format.

Click [Browse] button to activate the file Selectr and Select the file.
Delimiter mode Required Not available Select how to specify the delimiter.
  • [Select from list]: (default)
    Select delimiter from the list.
  • [Enter directly]:
    Input delimiter directly into the field.
  • [Enter character code]:
    Input delimiter into field with character code.
  • Corresponding input field is changed according to selected specifying method.
Select from list / Delimiter Optional Not available Select delimiter.
  • [Comma]: (default)
    Specify a half comma(,).
  • [Tab]:
    Specify the key.
  • [Space]:
    Specify space ( ) .
  • [Semicolon]:
    Specify a semicolon (;).
  • [Slash]:
    Specify a slash (/).
  • [Vertical bar]:
    Specify a Vertical bar (|).
  • Valid when you select [Select from list] from [Delimiter mode].
Enter directly / Delimiter Optional Available Input one delimiter.
  • Valid when you select [Enter directly] from [Delimiter mode].
  • You can not specify the double quotation as delimiter.
Enter character code / Delimiter Optional Available Enter character code.
Character code input is converted to encode specified in [Encoding].

Input with Octal (prefix "0" <the number zero>), decimal (no prefix), hexadecimal (prefix "0x" <the alphabet X and the number zero> or "#") is available.
If padding is composed of multiple bytes, input with being separated by commas.Ex.: 0x10, 0x13
  • Valid when you select [Enter character code] from [Delimiter mode].
  • You can input character code converted to one character.
  • You cannot specify character code converted to line code or double quotation.
Column list Optional - Specify the column.

Each column can be operated with the following buttons.
  • [Add]:
    Add a column.
  • [Up]:
    Move the order of the selected column upwards by one.
  • [Down]:
    Move the order of the selected column downwards by one.
  • [Delete]:
    Delete a column.
  • Write data of all the columns set in [Column list].
  • Column name specified in [Column list] is displayed in schema of Mapper.
Column list/Column name Required Available Input the name of the column.

You can set the first row of the file specified in [File] of property action of [Update column list] as the column name.
 
Columns list / Quotation Optional Not available Select whether to enclose each column with double quotes.
  • [Checked]:
    Enclose columns with double quotes.
  • [Not Checked]: (default)
    Do not enclose columns with double quotes.
 
Property Action
Item name Description Remarks
Preview Start the previewer, display the contents of the file specified in [File].
  • Disabled when specified file dose not exist, or variables are set in [File].
  • Encoding specified in [Encoding] is displayed.
  • You can not edit the file contents.
  • Files with file size smaller than 1MB can be displayed in previewer.If the file size exceeds 1MB, 1MB size contents from the beginning of the file are displayed.
Update column list Set the first line of the file specified in [File] as the column name.
  • Invalid when specified file dose not exist, or variables are set in [File].
Get column name from the first row Select the file in the file Selectr and set the first line of the file as the column name.  
Get column count Select the file in the file Selectr and set the number of columns of the file as the number of columns of the column name.  
Write Settings
Item name Required / Optional Use of Variables Description Remarks
Encoding Required Available Select or input write file encode.

Use only the canonical name supported by Java SE Runtime Environment 8 when specifying the encoding directly in the field.
Refer to "Supported Encodings"(http://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html) for details.
  • For information regarding the default values used, refer to "Default encoding".
New line code Required Not available Select a new line code.
  • [AUTO]: (default)
    As the new line code of DataSpiderServer running OS.
    • Windows:
      CR+LF
    • UNIX/Linux:
      LF
  • [CR]:
  • [LF]:
  • [CR+LF]:
 
Overwrite Optional Not available If the specified file exists, Select whether to overwrite it or not.
  • [Checked]: (default)
    Overwrite.
  • [Not Checked]:
    Do not overwrite.Error occurs if file already exists.
 
Append Optional Not available If the specified file exists, Select to overwrite it or append it to the end of the file.
  • [Checked]:
    Append to the end of the file.
  • [Not Checked]: (default)
    Overwrite.
  • Valid only when [Overwrite] is checked.
Insert column name in the first line Optional Not available Select whether to insert column names to the 1st line in specified file.
  • [Checked]:
    [Column name] in [Column list] is inserted into the first line.
  • [Not Checked]: (default)
    Column names are not inserted.
  • The column name is inserted to the first line of result data instead of the first line the the write file.
Do not insert the column name when the file exists Optional Not available Select whether to insert the column name to the first line of result data if specified file exists.
  • [Checked]:
    If the specified file exists, do not insert the column name to the first line of result data.
  • [Not Checked]: (default)
    Insert the column name to the first line of result data.
  • Enables only when [Insert column name in the first line] is checked.
Transaction
Item name Required / Optional Use of Variables Description Remarks
Execute transaction processing Required Not available Select whether to perform transaction processing.
  • [Checked]:
    Perform transaction processing.
  • [Not Checked]: (default)
    Transaction processing is not performed.
Refer "File type adapter transaction" for more information.
 
Comment
Item name Required / Optional Use of Variables Description Remarks
Comment Required Not available You can write a short description of this adapter.
The description will be reflected in the specifications.
 

Schema

Input Schema

Depending on the [Column list] setting, the number of columns may be different.
See "Schema of Table Model" for details regarding schema structure.

Output Schema

None.

Loading schema in Mapper

Schema is loaded automatically.
See "Edit Schema for any details.

Transaction

Transaction is supported.

Transaction is enabled only when [Execute transaction processing] in [Transaction] is checked.

PSP Usage

PSP is supported.
For details on PSP, refer to "Parallel Stream Processing".

Available component variables

Component variable name Description Remarks
count Return the number of lines of written data.
  • The value defaults to null.
message_category Stroes the category to which corresponding message code belongs to, when an error occurs.
  • The value defaults to null.
message_code Stores its corresponding message code of occured error.
  • The value defaults to null.
message_level Stores the severity of the corresponding message code of the occured error.
  • The value defaults to null.
error_type Returns the error type when error occurred.
  • The value defaults to null.
  • Error is represented in the format depicted below.
    Example:java.io.FileNotFoundException
  • The message may vary depending on the DataSpider Servista version.
error_message Return the error message when error occurred.
  • The value defaults to null.
  • The message may vary depending on the DataSpider Servista version.
error_trace Return trace information when error occurred.
  • The value defaults to null.
  • The message may vary depending on the DataSpider Servista version or the client application used.

Specification Limits

Main exceptions

Exception name Causes Solution
InputDataNotFoundException [Input data] is not specified. Specify the [Input data], or draw the data flow.
InvalidPropertyConfigurationException
<Property name> is not specified.
[<Property name>] is not specified. Specify [<Property name>].
InvalidPropertyConfigurationException
Invalid delimiter is specified.
Invalid character is input in [Delimiter] Please input valid character in [Delimiter].
FileIsDirectoryException Path input in [File] is directory. Input file path in [File].
FileAlreadyExistedException File specified in [File] already exists . Put check in change file name of [File], or [Overwrite] of [Write Settings].
FileIsLockedException File specified in [File] is locked. Please go to Windows Explorer or CLI to unlock.
java.io.FileNotFoundException
Another processing is in use.
File specified in [File] is being used by another process. Please check whether it is used by other processing.
java.io.UnsupportedEncodingException Encodes that are not supported in [Encoding] are specified. Specify an encoding that is supported in Java SE Runtime Environment 8.
Refer to "Supported Encodings"(http://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html) for details.

Notes