Before diving into the technical challenges, let’s start with a quick overview. A Map Editor is a tool used to transform data from one format to another, commonly from structured formats like XML, CSV/Excel, flat files into standard EDI documents such as ANSI X12, EDIFACT and vice versa (EDI to XML/flat file). In real world integrations, input data can come in various forms, including JSON, CXML, EDI or even PDFs. This data is typically converted into a structured XML format, which is the most commonly used format, and then defined using an XSD (XML Schema Definition) to establish the input structure. Once the schema is in place, the mapping process begins, where each element from the input is transformed into the required EDI output format. In this article, I’ll walk through a practical scenario where I converted an XML invoice into an EDI 810 document and the real issues I encountered along the way.
My input was an XML file structured according to the following schema.
Simple XML. However, converting this into a proper EDI 810 output involved significant troubleshooting. Here is every problem I hit and how I fixed it.
When I ran my first test translation, the map compiled fine but the translation report showed:
My output needed IT1-01 to be a line number 1, 2, 3 for each service. But my XML had no line number field. I needed to generate it automatically.The solution is an Accumulator Sterling's built in counter.
- Click IT1-01 field → Properties → Standard Rule tab
- Select Use Accumulator
- Click New to create an accumulator entry
- Set:
- Primary Accumulator: 0
- Name: LineCounter
- First operation: Increment primary
- Click New again for a second entry:
- Primary Accumulator: 0
- First operation: Use the primary accumulator
Important: You need both entries. Increment adds 1 to the counter. Use outputs the current value. Without both, nothing appears.
Second important thing: My IT1-01 was outputting 1.0, 2.0, 3.0 instead of 1, 2, 3. This is
because the field format was set to Real (decimal). Fix it by going to IT1-01 →
Properties → Validation tab → change format from R to N0.
I had both Tax and Discount in my XML. My first instinct was to put both in TXI segments. But there is an important difference:
- TXI (Tax Information): Use this strictly for tax amounts
- SAC (Service, Promotion, Allowance or Charge): Use this for discounts, allowances, or surcharges
So the correct mapping is:
- Tax → TXI-02 (with TXI-01 hardcoded as GS)
- Discount → SAC-05 (with SAC-01 hardcoded as A and SAC-02 hardcoded as D240)
In my XML there was no discount code field just the discount amount. So I hardcoded SAC-01 and SAC-02 as constants and only mapped the amount from XML.
Problem 4: The Decimal N2 vs N0
My output was showing:
SAC*A*D240***500~
Instead of:
SAC*A*D240***5~
The discount value 5 was becoming 500. The tax value 10 was becoming 1000.
The cause: SAC-05 field format was set to N2 which means 2 implied decimal places. Sterling interprets 5 as 0.05 and then outputs it as 500 in the EDI format.
The fix: