Create a Text Document Definition from a Sample File¶
This page covers the steps to create a text document definition from a sample file.
Steps for Creating a Text Document Definition from a Sample File¶
Make sure you have opened the appropriate project in which you want to create/change the new text document definition.
There are several ways you can start to create a new text document definition:
- Select New in the File menu, then choose New File Format from the sub-menu;
- Click the down arrow next to the file icon in the toolbar, then choose New File Format from the sub-menu; or
- Right-click on Documents in the hierarchical tree in the Design tab in the left pane of the screen, then choose New File Format from the popup menu.
Your new text document definition appears in its own New File Format tab in the right pane of the window.
Click on the Create From File... button. This displays the Create file structure from template file dialog:
In the dialog, select the type of sample file you want to use. There are three supported formats:
Sample flat file with column names - A sample input file with the first row containing the column names. This is available only when creating a character delimited file structure. The delimiter character is specified in a separate box. If any field name is not supplied, the default name "F" + [Column number] will be used. For example, if the second column does not have a name in the sample file, it will be given the name "F2". The data in the sample file will be parsed to best determine the data type for each column.
Sample flat file w/o column names - As above, only the column names are not included in the sample file (i.e. the first row contains data).
Simple text definition - A definition file containing rows for field information. Each row has the field name in the first column, the data type in the second column, and, if it is a fixed field document, the length of the field in the third column. The columns can be separated by comma, tab or semicolon. This delimiter character is not the same as the document delimiter, which is defined in the UI. To specify the data type, you can use the beginning of the data type name as long as it uniquely identifies the data type. For example, a date can be represented by "da", and a string by "str".
Select the sample file , either by browsing to it in a file browser by pressing the "Browse..." button, or by typing or pasting the path to the file directly into the field. (Another way is to drag the file from Explorer (on Windows) and drop it into the field.) The first few lines of the file will be displayed in the text area below the file field. This allows you to review the file, making sure it is correct, before creating the structure.
Click the OK button. This will bring you to a screen that displays the properties of the new text structure, as created from the sample file. In this screen you can make additional adjustments to the created structure, if necessary. Note: The OK button is disabled if the current input in the dialog is invalid or incomplete.
Click the Save button to save the new text structure in your project.
Unlimited-precision data types, such as XML decimal, are converted to double data types and therefore have a precision limit imposed on them that could, as a result, truncate data. The precision limit is within the range of the min and max values of a signed long, which is –2,147,483,648 to 2,147,483,647. If outside of this range, consider using a string data type.
These are two examples of flat file definitions that are appropriate for these steps.
Example 1: Sample flat file with column names
LineItemId,Title,Quantity,Price,Tax 1,The English Patient,1,12.95,1,07 2,Rochelle Rochelle,1,29.95,2,47
Example 2: Simple text definition
LastName,String,20 FirstName,String,20 Birthday,date,10 wt,Float,10