Skip to main content

EDIFACT

An EDIFACT message is a run of segments, each ending with ', named by its first element: UNB, UNH, NAD, LIN. Elements are split by + and components by :, and ? makes the character after it plain text:

NAD+BY+5412345000013::9++ACME?+CO'

There, the buyer's name is ACME+CO: the ? keeps the + from splitting it. A UNA segment at the start can change the separators, and the builder reads them from there.

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. Pick a segment by clicking its tag at the start of any of its lines.
  2. Name its elements. Click one on any of its lines and name it in the bar under the lines. An element with components, such as 260302:1200, shows each component on its own: click one to name it.
  3. Name the segment above the lines, and say what it goes inside: each QTY belongs to the LIN above it. The dropdown beside each tag says whether it reads as one record or a list.
Sample 11 lines, CSV: UNB+UNOA:2+SENDER+RECEIVER+26030…

Paste a few lines of your own file to make a schema for it; the layout is worked out from what you paste.

Lines
UNB lines are calledClick a tag on the left to work on other lines.
+UNOA:2+SENDER+RECEIVER+260302:1200+1
+1+ORDERS:D:96A:UN
+220+PO-1001+9
+BY+5412345000013:·:9+·+ACME?+CO
+1+·+A100:SA
+21:10
+2+·+B200:SA
+21:5
+S
+9+1
+1+1
Click a field or a part of one to name it. Shift-click another field to select the fields between, to make a list of them.
Writes the sample back as it was.
{
"unb": {
"field1": {
"part1": "UNOA",
"part2": 2
},
"field2": "SENDER",
"field3": "RECEIVER",
"field4": {
"part1": 260302,
"part2": 1200
},
"field5": 1
},
"unh": {
"field1": 1,
"field2": {
"part1": "ORDERS",
"part2": "D",
"part3": "96A",
"part4": "UN"
}
},
"bgm": {
"field1": 220,
"field2": "PO-1001",
"field3": 9
},
"nad": {
"field1": "BY",
"field2": {
"part1": 5412345000013,
"part3": 9
},
"field4": "ACME+CO"
},
"lin": [
{
"field1": 1,
"field3": {
"part1": "A100",
"part2": "SA"
},
"qty": {
"field1": {
"part1": 21,
"part2": 10
}
}
},
{
"field1": 2,
"field3": {
"part1": "B200",
"part2": "SA"
},
"qty": {
"field1": {
"part1": 21,
"part2": 5
}
}
}
],
"uns": {
"field1": "S"
},
"unt": {
"field1": 9,
"field2": 1
},
"unz": {
"field1": 1,
"field2": 1
}
}

Every setting is in the EDI section of the flat files reference.