简体   繁体   中英

Can we process an EDI 852 format file in Azure Data Factory?

I want to check if converting an EDI 852 formatted file into a CSV file through ADF or logic apps is possible.

Assuming that you had an Integration Account linked with the Logic App so that you could make use of the built-in BizTalk 852 to XML parsing and then XSLT to transform to CSV (or to a flat XML structure - which you can then convert to JSON in the Logic App using json(xml(body('Convert_852'))) in a Compose action and then use a Create CSV Table action to convert to CSV.

If you don't have an Integration Account, it'll be quite a bit harder, but should still be possible in a Logic App, splitting the 852 into an array of strings first by the segment terminator (which will be the character at position 105 of the ISA segment - possibly with a CR and/or LF appended) and then splitting each of those strings into elements using the element separator at position 3 of the ISA segment.

The header data will be in the first two or three elements of the XQ segment (3 if the 852 represents a date range, 2 if there's only a handling code and reporting date).

Line-level data is arranged like this:

  • LIN: product data
    • ZA: product activity type (eg. qty sold, qty on order, qty lost, etc)
      • SDQ: location/quantity reporting (optional)

so you'd need to consolidate SDQ data into an array inside a ZA object and then consolidate an array of ZA objects into its parent LIN object and then roll all of the LIN objects up into an array inside the top level 852 object probably using nested For Each loops containing Switch and Append To Array Variable actions.

You can then use Select actions inside more For Each loops to flatten the data to CSV - or just push the resulting JSON to ADF or CosmosDB

EDI 852 are NOT STANDARDIZED.

Although the various available segments and outer control structures are (ISA/IEA, GS, GE), the internals are NOT.

One company's 852 can be wildly different than another's.

You'll need the company's EDI852 specification before it can be parsed properly, regardless of what tools you have available.

A sample specification looks like this :

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM