Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
A flat file in the Designer is defined via the following structure:
- A flat file definition
This is a class having the stereotype FlatFile. It represents the file itself. The properties of this class represent the data records. - One or more flat file record definitions
These are classes having the stereotype FlatFileRecord. They represent the data records of the flat file and are used as a type for the properties of the FlatFile class. - One or more flat file record properties
These are properties of the FlatFileRecord having the stereotype FlatFileAttribute. They represent the data fields of the flat file record.
Each flat file stereotype comes with a list of attributes to define certain functionality like length, format, order and more.
The following class diagram shows the flat file structure of the related example:
Defining the Flat File
Define a flat file by creating a root class with stereotype FlatFile. The properties of this class must be complex and specified as to be flat file records. A flat file can have multiple flat file record definitions representing different record types. In the example above these are Headerand Product.
Tip |
---|
Assign a meaningful name because the output object flow of the Flat File adapter action uses this class as a type. |
A flat file can have the following stereotype attributes specified:
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
Defining the Flat File Record
Define a flat file record by applying the stereotype FlatFileRecord to a class. Such classes can be used as types for properties of flat file definitions (ProductList in the example above).
Flat file records have properties that specify the structure and layout of the record. You can specify e.g. the sorting order of the properties within the record, the format of number properties, the record layout (separated, fixed, pattern) and more.
A flat file record can have the following stereotype attributes specified:
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
Defining Flat File Record Properties
Properties of a flat file record specify the structure and layout of the record. All properties need to have stereotype FlatFileAttribute applied. Depending on the layout type of the flat file (separated, fixed or pattern), you can specify different attributes.
Attribute Settings for Separated Flat File Record Layout
Whether a flat file has a separated layout is specified on the flat file record class in attribute attributeLayout. For records with a separated layout, you must specify a separator in attribute attributeSeparator. The default separator is ',
' (comma).
The order of properties is defined on the property by either the order attribute or by specifying an offset within the record.
A flat file record property that is part of a can have the following stereotype attributes specified:
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
Attribute Settings for Fixed Flat File Record Layout
Whether a flat file has a fixed layout is specified on the flat file record class in attribute attributeLayout. With fixed layouts, each record property has a fixed length given by the externalLength attribute. Optionally, you can specify a padding to fill the attribute from the left or right side with a given character.
The order of properties is defined on the property by either the order attribute or by specifying an offset within the record.
A flat file record property can have the following stereotype attributes specified:
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
The Flat File Example
The flat file example service defines a flat file with a fixed layout. The following table explains the flat file definitions for this example:
Element | Stereotype | Stereotype Attribute | Description | ||
---|---|---|---|---|---|
Flat File | ProductList | FlatFile | - | Defines the flat file structure ProductList. | |
Flat File Record | Header | FlatFileRecord | attributeLayout | fixed | Specifies the header record as to be structured by fixed lengths. |
composeMacro | ResetCounter(AUTO0) | Reset the automatic counter AUTO0 when this record is composed. | |||
evalutationOrder | 1 | Evaluate this record first, before evaluating the product records. | |||
lineNumber | 1 | This header record is the first record in the file. | |||
Product | FlatFileRecord | attributeLayout | fixed | Specifies the product record as to be structured by fixed lengths. | |
evaluationOrder | 2 | Evaluate this record second, after evaluating the header record. | |||
Flat File Property | line | FlatFileAttribute | composeMacro | GetCounter(AUTO0) | This property is set from the automatic counter AUTO0. |
externalLength | 5 | This property has a length of 5 characters in the record. | |||
order | 10 | This property is the first property in the record (as all other properties have a higher order).
| |||
number | FlatFileAttribute | externalLength | 5 | This property has a length of 5 characters in the record. | |
order | 20 | This property is the second property in the record. | |||
name | FlatFileAttribute | externalLength | 20 | This property has a length of 20 characters in the record. | |
order | 30 | This property is the third property in the record. | |||
category | FlatFileAttribute | externalLength | 20 | This property has a length of 20 characters in the record. | |
order | 40 | This property is the fourth property in the record. | |||
type | FlatFileAttribute | externalLength | 10 | This property has a length of 10 characters in the record. | |
order | 50 | This property is the fourth property in the record. | |||
price | FlatFileAttribute | externalLength | 10 | This property has a length of 10 characters in the record. | |
order | 60 | This property is the sixth property in the record. | |||
format | FM0000000.00 | The price should be formatted like specified, e.g. 0000065.50. | |||
padding | Left("0") | The price should be filled with zeros from the left side, e.g. 0000065.50. | |||
serviceInterval | FlatFileAttribute | externalLength | 5 | This property has a length of 5 characters in the record. | |
order | 70 | This property is the seventh property in the record. | |||
padding | Left(" ") | The service interval should be filled with blanks from the left side, e.g. " 52". |
Panel | ||
---|---|---|
| ||
|
Multiexcerpt include | ||||||||
---|---|---|---|---|---|---|---|---|
|