Skip to main content

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.

  1. Name the columns. Drag across ORD001 on the first line, type id and choose Name it. Do the same for the first item's code, A100, and quantity, 003.
  2. 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 it items and choose Make a list.
  3. A list inside it. Double-click the first size, S, name it sizes and choose Make a list: each item now has a list of sizes. Click the S again to name the size itself.
  4. 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.

Lines
ORD001A100003SMB200001L·
ORD002A100001S·
ORD003D400002MLE500005XS
Click a character to select its field, and shift-click to add the fields beside it. Drag across some characters to name them.
Writes the sample back as it was.
{
"rows": [
{
"field1": "ORD",
"field2": 1,
"field3": "A",
"field4": 100003,
"field5": "SMB200001L"
},
{
"field1": "ORD",
"field2": 2,
"field3": "A",
"field4": 100001,
"field5": "S"
},
{
"field1": "ORD",
"field2": 3,
"field3": "D",
"field4": 400002,
"field5": "MLE500005XS"
}
]
}

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.

Lines
FH lines are calledClick a tag on the left to work on other lines.
20260302ACMEPAY···
0001PAYROLL···
ANA·SMITH·······0000125000MARCH·SALARY
BENJAMIN·JONES··0000008950EXPENSES····
0002000000133950
0002SUPPLIERS·
TEA·&·CO········0000001225INV·2231····
0001000000001225
00020003000000135175
Click a character to select its field, and shift-click to add the fields beside it. Drag across some characters to name them.
Writes the sample back as it was.
{
"fh": {
"field1": "20260302",
"field2": "ACMEPAY"
},
"bh": [
{
"field1": 1,
"field2": "PAYROLL",
"en": [
{
"field1": "ANA SMITH",
"field2": 125000,
"field3": "MARCH SALARY"
},
{
"field1": "BENJAMIN JONES",
"field2": 8950,
"field3": "EXPENSES"
}
],
"bt": {
"field1": "0002000000133950"
}
},
{
"field1": 2,
"field2": "SUPPLIERS",
"en": [
{
"field1": "TEA & CO",
"field2": 1225,
"field3": "INV 2231"
}
],
"bt": {
"field1": "0001000000001225"
}
}
],
"ft": {
"field1": "00020003000000135175"
}
}

Every setting is in the flat files reference.