CSV
See the following sections to parse CSV input or format CSV output.
Setting Stream Properties
You can set the following properties to parse the format of CSV input or to format CSV output. Select the necessary component and expand the Format property in the Stream pane.
| Property name | Value | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Start Row | Specify the line number of the first record. The default value is 1. If the first line of the data contains a header row, enter 2. | ||||||||||||
| Number of Fields | Specify the number of fields each record in the stream contains. The default value is 3. | ||||||||||||
| Separator | Select the delimiter that separates the fields. The default value is a comma.
|
||||||||||||
| Quote Character | Select the quote character the Flow Service uses to surround each CSV field. Note that you don't need to specify a quote character when you're reading a string from a CSV file. If the quote character occurs in the text, the Flow Service escapes the quote character with the Quote Escape Character property. The default value is a double quote: "
|
||||||||||||
| Quote Target | Select the target fields to quote.
|
||||||||||||
| Quote Empty Fields | Select whether to quote empty fields.
|
||||||||||||
| Quote Escape Character | Specify the character to use to escape a quote character that appears in a string. The Flow Service puts the quote escape character in front of the quote character.
|
||||||||||||
| Trim Whitespace | Select whether to delete whitespace from the beginning and end of a string that is not enclosed in quotes. This property is valid only when reading from a file. When a quoted string is being read, whitespace isn't trimmed regardless of the value specified here.
|
||||||||||||
| Output Encoding | Select the stream's encoding.
|
||||||||||||
| Linefeed | Select the linefeed that separates the records in the output CSV. This property is only valid when writing to a CSV file. * When reading a stream from a file, the line feed code does not necessarily have to be the specified line feed code. * When a string is output, if a line feed code exists in the output string, the line feed code specified here is output.
|
||||||||||||
| Output Field Names | Specify whether to output a header row, which contains the field names in the first line of the output stream.
|
Defining Stream Fields
Define the name and data type to define a field in a CSV stream.
| Field name | Enter the field name. |
|---|---|
| Data type | Select String, Boolean, Integer, Double, Decimal, or DateTime. (You can't specify binary.) |
Validating Field Names
Note the conditions for a field name to be valid:
- You can't use "/" (forward slash).
- There's no limit to the length of the name.
- The field name is case sensitive.
Note
-
Outputting null fields: When a component is reading a file and the data contains less fields than the field definition's field number, the missing fields are output as null fields. If the file contains more fields than the number of the stream's field definitions, the extra fields are ignored.
-
Escaping linefeeds: When a string field includes a linefeed and the Quote Character property is set to "none," the string returned is the part of the string up to the linefeed.