Format Designer - Flat File Schema Definition - field

The field element defines a single field in the input or output data.

<field
		name
		output='yes|no'
		field-sep
		valid-value
		default-value
		leading-chars
		trailing-chars
		output-if-empty='no'
		max-length='128'
		min-length='0'
		truncate='no'
		quoted='auto'
</field>

Attributes

  • name

    Defines the name of the field. If the output attribute is set to yes this name is used as the XML tag name in the output, and used to match the choice with an XML tag during input.

  • output

    Defines whether the field is to be included in the output or not. The valid values for this attribute areyes and no, where a value of yes means the record causes a tag to be generated in the output and no means that the field is purely describing the data structure and can be used to skip data. The default is yes.

  • record-sep

    Defines an optional field separator string for the field. This can be any string value. The following special values can also be used:

    • \r The carriage-return character
    • \n The line-feed character
    • \t The tab character

    If no field separator is specified then the max-length attribute is used to read the data (the data is fixed-length).

    The last field in a record can omit the field separator, in which case the record separator for the field is used, if one is specified.

  • valid-value

    You can use this attribute to define a value that the field must have. This is used when reading flat data to validate the data, and as part of the choice element to help with pattern matching. When writing flat data and the output attribute is set to no, the fixed value you specify for valid-value is written to the flat data.

  • leading-chars

    A string containing characters to be stripped from the beginning of the value when it is read from the flat file. When data is written to the flat file and the trailing-chars attribute is not specified, the first of these characters is used to left-pad the value to make it the correct length (as determined by the min-length attribute).

  • trailing-chars

    A string containing characters to be stripped from the end of the value when it is read from the flat file. When data is written to the flat file, the first of these characters will be used to right-pad the value to make it the correct length (as determined by the min-length attribute).

  • output-if-empty

    Determines whether the field is to be written out when the contents are empty. The valid values for this attribute are yes and no. The default is no.

  • max-length

    Defines the maximum length of the data. This value is used to determine how much data should be read. The default is 128.

  • min-length

    Defines the minimum length of the data. This is used for validation, pattern matching by the choice element, and also for padding when the leading-chars or trailing-chars attributes are specified. The default is 0.

  • truncate

    If this option is set to yes, the data written back to the flat file format is truncated to the specified max-length. The default is no.

  • quoted

    This option determines whether or not quotation marks should be placed around the data. This is used to allow the field separator character to appear within the actual data (since the FSD processor will not look inside a quoted string for the field separator). This attribute can be set to the following values:

    • No

      The data should not be treated as a quoted string such as the data will be written verbatim into and out-of the flat file.

    • Yes

      The data should be treated as a quoted string. When converting from flat format to XML the data will have any surrounding quotation marks removed and any escaped quotation marks will be converted to single quotation marks.

      When converting from XML format to flat format the data will be surrounded in quotation marks and any existing quotation marks will be escaped (i.e. a single quotation mark will be turned into a double quotation mark, so " will become "", and so on.)

    • Auto

      This option only applies when converting delimited flat file data to XML. If the data contains the field separator it will be treated as if the quoted option was set to yes.

    The default for this value is auto.