File Definitions
The File Definitions module is used to design the structure of the files that are either read from a Source file into the Statelake configuration, or written to a Destination file.
File Definitions allow you to "describe" the structure of the files, which then allows Statelake to understand your particular file structure, enabling the easy reading and writing of data and giving you the flexibility to interact with any file as you are in complete control over the definition.
A File Definition would only apply to a Source file or a Destination file, so it is advisable to understand the purpose of the definition before progressing.
There are four types of files that can be specified in this module - “flat” text files, XML files, Excel (binary), and EDI (EDIFACT) type files.
“Flat” Files are any structured text file that have either a fixed length or are delimited.
XML Files are any XML based file that can be described using XML Schema (XSD).
EDI Files are any UN/EDIFACT or ANSI based files.
Excel files are those generated by Excel.
A File Definition is an in-memory representation of the data you are going to read or write from the file.
When reading Source data, the definition is opened and the data loaded from the file into memory, where it is retained until the definition is closed.
When writing Destination data, the definition is opened against the database but no file is read. This provides an in-memory representation of what the data structure is. You then write data into the definition using a Map, and this is subsequently output in the appropriate format to the file specified in the definition. Even after writing the data to the file, the data is retained in memory until the definition is closed. If the act of writing to the file has caused auto-generated fields to create values, these values can be returned to the in-memory dataset.
You can create a single File Definition and use it against multiple similar files simply by assigning a different File Connection. When assigning a File Connection to a File Definition it is considered a design-time assignment,
When coming to use the File Definition in an Action, you have the chance to reassign the File Connection which is known as a run-time assignment. This allows you to use the same File Definition in multiple Actions, each with their own File Connection.
The Designer window allows you to define the data structure to represent the data in your file. This provides the Statelake application the "meta data" for it to understand your file, and enables reading and writing of data to the file.
The Designer window is accessed by clicking the Design button on the general screen. The general screen is the initial window that opens when creating or editing a File Definition. This screen allows you to input the main parameters of the File Definition.
The general screen should be completed prior to opening the Designer.
Buttons
Button Name | Description |
---|---|
Save | Click to Save any changes you have made. All changes will be lost if you do not click the Save button. |
Cancel | Click to Cancel any changes you have made. |
Delete | Click to Delete this module. You will be asked to confirm your choice. |
Design | Click this window to open the Designer. You should populate the fields of the main screen prior to designing the File Definition. |
Test File Load | Click this button to load a file into the definition. The associated File Connection will be used to find a file to load - ensure a file is sitting in the main directory of this File Connection that matches the File Search Pattern. A Log will display to show the results of loading the file. After loading you can close the Log window and open the Designer to preview the data itself. |
General Tab
The details required on this screen must be fully completed prior to advancing to Design.

Fields
Field Name | Description |
---|---|
File Type | Select either Flat File, XML File, EDI File (EDIFACT or X12), or Excel File. Flat File is the default. |
File Definition Name | A friendly name for the File Definition. |
DB Connection | Select the DB Connection(s) used on this File Definition. This is a design-time setting, and can be overridden with run-time setting on the Action. |
File Connection | Select the File Connection used on this File Definition. This is a design-time setting, and can be overridden with run-time setting on the Action. |
Disable automatic string trim | Disable the automatic trimming of blank spaces from the start and end of strings. |
Type-specific fields | See the individual file details, dependent on the File Type selected. |
Off the designer canvas there is a different dataview for each file type as selected -
a Flat File generates a File Dataview
an XML File generates an XML Dataview
an EDI File generates an EDI Dataview
an Excel File generates a Workbook Dataview