Interface File Formats

The layout of an interface is defined in text form in the Layout tab of the Interface Editor.

The layout consists of a global format section and one or more output sections. The format section defines properties such as date/time formats, number formats, and how empty (null) values are represented in the output. On the other hand, the output section defines how the data from one report should be laid out in the file. The following is an example where the output section is a CSV section.

Type= TextFile
# Global format --------------------------------------------------------------
Beginformat	
	<DefaultFormat
		NullValue="NULL"
		DefaultDateFormat="Type : DateTime
		  Format : 'MM\/dd\/yyyy'"
		DefaultDateTimeFormat="Type : DateTime
		  Format : 'yyyy-MM-dd HH:mm:ss'"
		DefaultDecimalFormat="Type : Decimal
		  Format : G
		  GroupSeparator : ' '
		  DecimalSeparator : ','"
		DefaultIntegerFormat="Type : Integer
		  Format : D
		  GroupSeparator : ' '"
		DefaultBoolFormat="Type : Bool
		  True : 'True'
		  False: 'False'"
		DefaultTextFormat="Type : Text
		  TextCase : Normal"
	/>
Endformat	

# CSV section ----------------------------------------------------------------
Beginsection	
Data= Transactions Report
Type= CSV
	<Format
		  ColumnSeparator=";"
		  LineSeparator="&#13;&#10;"
		  IncludeHeader="true"
	/>
Endsection

Global Format Section

The global format section describes how data should be formatted globally in the file, as well as some file-specific properties.

917

Nested Formats

Standard formats describe how specific data types like dates and numbers should be formatted to text before being written into the text file. Nested formats, on the other hand, allows the modification of already formatted values. As an example, you can take any string value and add a prefix and postfix to it, regardless of what the original type is.

915

Output Sections

An output section is a section that appears in the output file. It refers to one particular report via the Data field. A layout file can contain any number of output sections of particular types, each one containing a Data field, a Type field to determine the section base type, and a Format sub-section with type-specific configuration.
An output section is defined in the layout file using the Begin- and End-section delimiters.

Beginsection … Endsection

In between the delimiters, the section is specified. Mandatory fields include:

  • Data – The name of the report which data is formatted using the section.
  • Type – The type name of the section (CSV or Template).
  • Format – A sub-section snippet of XML with defines type-specific options.

OmniFi supports two different types of output sections: CSV and Template.

The Format sub-section of an Output section can also override formats from the global format section. The extract below shows a CSV section where the DefaultDateTimeFormat is overridden.

Beginsection	
Data= Transactions Report
Type= CSV
	<Format
		  ColumnSeparator=";"
		  LineSeparator="&#13;&#10;"
		  IncludeHeader="true"
		  DefaultDateFormat="Type : DateTime
		  Format : 'yyyy-MM-dd'"
	/>
Endsection

# CSV section ----------------------------------------------------------------
Beginsection	
Data= Transactions Report
Type= CSV
	<Format
		  ColumnSeparator=";"
		  LineSeparator="&#13;&#10;"
		  IncludeHeader="true"
		  DefaultDateFormat="Type : DateTime
		  	Format : 'MM\/dd\/yyyy'"
	/>
Endsection

CSV Type Section

A CSV section is an output section specifically used to output data in CSV format. It will lay out the columns in a sequence specified by the under lying dataset. It contains a Format section with CSV specific options.

# CSV section ----------------------------------------------------------------
Beginsection	
Data= Transactions Report
Type= CSV
	<Format
		  ColumnSeparator=";"
		  LineSeparator="&#13;&#10;"
		  IncludeHeader="true"
	/>
Endsection

Template type section

An output section of type Template can be used to generate wide variety of formats such as XML, HTML or SWIFT-MT, here exemplified by the β€œ01 Default” XML layout.

# 01 Default (OmniFi XML Query Compatible) (Transactions Report)------------
Beginsection
Type= Template
Data= Transactions Report

Beginformat
<Format 
  NullValue="null"
  Eof="&#13;&#10;"
  Newline="&#13;&#10;"
/>
Endformat

Beginheader
<?xml version="1.0" encoding="utf-8"?>
<Data>

Endheader

Begintrailer
</Data>
Endtrailer

Beginrow
  <Row>
    <Column name="Portfolio" value="["Portfolio"]" />
    <Column name="Transaction Number" value="["Transaction Number"]" />
    <Column name="Opening Date" value="["Opening Date"]" />
    <Column name="Nominal Amount" value="["Nominal Amount"]" />
    <Column name="Instrument" value="["Instrument"]" />
  </Row>

Endrow

Endsection

A template section consists of four parts

  • Format (delimited by Beginformat .. Endformat)
  • Header (delimited by Beginheader .. Endheader)
  • Body (delimited by Beginrow .. Endrow)
  • Trailer (delimited by Begintrailer .. Endtrailer)

Format section can be used to override any settings from the global format section. It supports a single additional property Newline, which allows you to decide how a newline should be represented in the output file. This is useful if you need to generate files in, for example, UNIX format.

Header will be output once at the beginning of the file and Trailer will be output one at the end of the file.

The Body section will be output once per row, and supports referencing of fields in the row data.

A field is referenced by the pattern [β€œ<Column Header>”], and the reference will be replaced with the corresponding value for each line.

Because Endrow is required to appear in the beginning of a new line, the newline at the end of the body section is omitted. To delimit each row output with a newline an empty row must be inserted before the Endrow delimiter, as shown below.

Beginrow
  <Row>
    <Column name="Portfolio" value="["Portfolio"]" />
    <Column name="Transaction Number" value="["Transaction Number"]" />
    <Column name="Opening Date" value="["Opening Date"]" />
    <Column name="Nominal Amount" value="["Nominal Amount"]" />
    <Column name="Instrument" value="["Instrument"]" />
  </Row>          
Endrow

The same is true for the Header and Trailer sections as well.