EDI Elements
What is an Element?
In the context of delimited data files, an element is the contents between two delimiters. Like in a spreadsheet, the element is the contents of a cell. In EDI, we have delimited segments, and just like a delimited file, the contents between the delimiters is the element.
So in this segment “PO1*1*8*EA*10**SW*H11510.REF*CT*089480-00-B-0336~”, the 5th element or PO1_04 is “10″, while the 6th element or PO1_05 is empty.
Empty elements are not necessarily null. Calling something null when the data type is know like an empty element can cause some data theory debates. I don’t want to start one here, but may write about that philosophical discussion at a later time.
What types of elements are there?
What we are really talking about is the data type. Each element in an EDI file has a specific data type defined. Part Numbers are Alpha-Numeric which means that they may contain letters in the alphabet, and number in any mixture. Where a price is not just a number, but is a currency. Letters are not acceptable in the price field, so one can’t populate it with “N/A” in any case.
I won’t describe all of the data types here. That is a discussion for some other time. Most of the time these are fairly easy to work with, especially when you have samples to work from. But there is another type of element. This is the encoded value element. This element does still contain a value, but it is in a code.
UOM or Unit Of Measure is the easiest to relate to, as it deals with something physical. In the PO1 segment above, we find the UOM in the PO1_03 element. In this case it means “each” and by putting “EA” in this position we don’t have to type out “each” every time we just us EA as the abbreviation for this.
Why do we do this? Well as I said the UOM is the easiest encoded element. Some of the other encoded elements that are available define larger concepts. Also, by having an encoded element, the EDI standard constrains the data to a rational type of data.
For instance, if you have an order response, we don’t want to have to process a free form response, we want to know if the product is accepted, back ordered or canceled. And I want to know this in the same way for everyone.
What is Element Notation?
Elements are contained in segments. The segment is referred to by the characters that preceded the first delimiter. Each element in the segment has the name of the segment followed by its position in the segment. Sometimes these are not separated, or they are separated by a space or underscore. The position of the element is 0 based counting. This means that the first position, the position preceding the first delimiter where the name of the segment is found, is position 0.
Thus in this segment, “N1^ST^Bill’s Grill^01^123456789~”, the N1 is N1_00. I prefer the underscore to the space or no delimiter format for clarity. But they are all used, so this would be the same as N101 and N1 01. We use a two digit position designator even for positions less than 10 for clarity as well. If there are any segments that develop more than 99 positions, there won’t be many. And even fewer will ever be used. And we don’t reduce it to just one digit, as N11 might actually exist, and that could cause confusion.
Now back to our example; N1_01 is “ST”. N1_02 is “Bill’s Grill” as so forth.
An example of how this is used is first found in our mapping rules that we need to write down. And then in our notes and documentation. If you wanted to say, “Whenever we have a ship to address for ‘Bill’s Grill’ we need to used the Duns number of ‘123456789′.” We could say , “When N1_01 = ‘ST’ and N1_02 = ‘Bill’s Grill’ then N1_03 = ‘01′ and N1_04 = ‘123456789′.” This way we are not leaving anything open to interpretation and clarity is our friend when writing rules for mapping and forming data.
You will see this used extensively in the mapping exercises here, and once you get the hang of using Element Notation, you will never write it any other way.
–
Looking for something else relating to EDI? Check out the EDI Primer post
–
Subscribe to "The Integration Engineer" by Email
Find out about the tools and services available at The Integration Engineer's Consulting site.











