Fixed-width
A fixed-width file has no delimiters: each column is a set number of characters. A line can also hold a list of its own, such as an order's items one after another, each item with sizes of its own:
ORD001A100003SMB200001L
That's order ORD001, then item A100, quantity 003, sizes S and M, then item B200, quantity 001, size L.
Tell Crosswalk how to read it
To read a file, Crosswalk needs its schema: the name and type of each field, and which ones are lists. The builder below makes one from an example, and shows the JSON it reads as you go. When it reads the example the way you want, the Schema tab has the schema to use in a map.
- Name the columns. Drag across
ORD001on the first line, typeidand choose Name it. Do the same for the first item's code,A100, and quantity,003. - Make a list of the items. Drag across the whole first item,
A100003SM. The bar shows what each line would hold as a list of items like it; name ititemsand choose Make a list. - A list inside it. Double-click the first size,
S, name itsizesand choose Make a list: each item now has a list of sizes. Click theSagain to name the size itself. - Click any character to see its field, rename it or change its type. What it reads marks where it is. Where a list's columns are already named, you can click the first and shift-click the last, instead of dragging.
Sample 3 lines, fixed-width: ORD001A100003SMB200001L
Paste a few lines of your own file to make a schema for it; the layout is worked out from what you paste.
With headers and trailers
Many fixed-width files have several kinds of line, each starting with a tag: a file header, a batch header, entries, trailers. Click a line's tag to work on that kind of line: name it above the lines, and say what it goes inside. The dropdown beside each tag says whether that kind reads as one record or a list.
Sample 9 lines, fixed-width: FH20260302ACMEPAY
Paste a few lines of your own file to make a schema for it; the layout is worked out from what you paste.
FH lines are calledClick a tag on the left to work on other lines.Every setting is in the flat files reference.