User Tools

Site Tools


transformations:importfixedwidthtext
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


Previous revision
Next revision
transformations:importfixedwidthtext [2021/03/04 21:38] craigt
Line 1: Line 1:
 +{{ transformations:ImportFixedWidthTextAction.png}}
 +======IMPORT FIXED WIDTH TEXT FILE======
 +(Category: //Import | File//)
  
 +=====Description=====
 +This transformation imports text files with columns of fixed width. The width and name of every column have to be defined explicitly in the transformation properties.
 +
 +Use the __preview pane__ (click the //Show preview// button) to visually split text into columns. Click a character in the preview to create a splitter. Drag a column splitter left or right to adjust the column width.\\
 +\\ 
 +=====Action Settings=====
 +^Settings^Description^
 +|Load file|Fully-qualified file name of the dataset (includes relative or absolute path).|
 +|Encoding|ASCII, ANSI (with code page), and other types of encoding. If you're not sure what to choose, try UTF-8 as it's the most common Unicode encoding.|
 +|First loaded line contains headers|Check this "on" if the first line of data contains the field names (headers).  If //unchecked//, columns are given\\ generic "column" names unless user-assigned names are provided in the //New columns// section. (see below) |
 +|New columns|Refer to the table below for //new column// settings.|
 +|Put remaining symbols into column|Check "on" to capture any characters falling outside the final column's defined width.  NOTE: If the\\ //First loaded line contains headers// is checked "on", this column will be named "Remainder" by default.\\  Otherwise, the user can provide the name for this column.|
 +
 +^**//New columns// settings**^^
 +^Settings^Description^
 +|Add more columns|This button will open a list where the columns in the imported file can be explicitly defined by Name and Width.\\  NOTE:  Changes made here can be viewed in the __preview pane__ by clicking the //Show preview// button at the top.|
 +|Name|The names to be assigned to the incoming columns.|
 +|Width|The size, in characters, of the column.  Characters that extend past the width of the final column are dropped unless the\\ //Put remaining symbols into column// option is used. (see above).|
 +
 +\\ 
 +=====Advanced options=====
 +^Settings^Description^
 +|Decimal|Select whether decimal points are represented by a point (.) or comma (,).|
 +|Skip first lines|Defines the number of rows in the incoming dataset to skip before importing data.  Use this in cases where\\ leading rows may contain blank rows or metadata not to be included in the dataset.|
 +|Maximum number of lines to load|The maximum number of rows to be imported.  Use "0" to read in all ("unlimited") rows.|
 +
 +{{transformations:fixed_width_preview_pane.jpg}}
 +
 +=====Importing Multiple Files=====
 +This action can import multiple files.  See [[import:fileimportmodes|Importing Multiple Files]] for more information.\\
 +\\ 
 +=====Use cases=====
 +Use the ''Import fixed width text file'' action when you have text-based data in which the fields are defined by //spacing// (spaces, tabs, leaders, etc.) rather than delimiting characters and you need to import them into columns.\\
 +\\ 
 +If your data has __delimeters__, use the ''Import delimited text file'' action, instead.  If your data is consolidated in a single field, and spacing between values is inconsistent, use the ''Import plain text'' action to read it in and use other actions to parse the individual values into columns.\\
 +\\ 
 +=====Examples=====
 +**Example 1:** You are importing data from a legacy system's fixed-width output containing names and addresses.  The first row contains header information and the column widths are known to be 20, 30, 15, 2, 5.
 +<code>
 +Name                Address                       City           STZip
 +John Hardy          111 Any Street                Boston         MA02110
 +Amanda Smythe       16 East Valley Lane           Hanover        MD21076
 +Rick Johanssen      14 Sunset Ave, Apt 16B        Delaware City  DE19706
 +</code>
 +//Use the following settings to import this dataset://
 +>  Column settings:  Set these in the preview pane or enter them under //New columns//.
 +>  (column 1) Name: "Name", Width: 20
 +>  (column 2) Name: "Address", Width: 30
 +>  (column 3) Name: "City", Width: 15
 +>  (column 4) Name: "ST", Width: 2
 +>  (column 5) Name: "Zip", Width: 5
 +>  First loaded line contains headers = "checked"
 +//For safety, we will add a column to capture overflow characters://
 +>  Put remaining symbols into column = "checked"; Column = "Remainder" (default)
 +//Ouput dataset://
 +^Name^Address^City^ST^Zip^
 +|John Hardy|111 Any Street|Boston|MA|02110|
 +|Amanda Smythe|16 East Valley Lane|Hanover|MD|21076|
 +|Rick Johanssen|14 Sunset Ave, Apt 16B|Delaware City|DE|19706|
 +
 +
 +\\ 
 +**Example 2:**  You are presented with survey data that has been captured incorrectly - all values have been compressed into a single field.  There are 5, single-digit responses, all combined together.  The first row is the header row of question numbers (1-5):
 +<code>
 +12345
 +14324
 +11232
 +45455
 +34234
 +55234
 +</code>
 +//To expand these response values into their appropriate columns://
 +>  Column settings:  Set these in the preview pane or enter them under //New columns//.
 +>  (column 1) Name: "1", Width: 1
 +>  (column 2) Name: "2", Width: 1
 +>  (column 3) Name: "3", Width: 1
 +>  (column 4) Name: "4", Width: 1
 +>  (column 5) Name: "5", Width: 1
 +
 +//Output dataset://
 +^1^2^3^4^5^
 +|1|4|3|2|4|
 +|1|1|2|3|2|
 +|4|5|4|5|5|
 +|3|4|2|3|4|
 +|5|5|2|3|4|
 +//(In this case, you could also have used the// ''Import plain text'' //action to read the entire field in and parse into separate columns later in the workflow.)//\\
 +
 +\\ 
 +=====See Also=====
 +
 +  * [[transformations:importtext|Import delimited text file]]
 +  * [[transformations:importplaintext|Import plain text]]
transformations/importfixedwidthtext.txt · Last modified: 2021/08/14 21:24 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki