Articles in this section

Handle multiple transaction sets (ST-SE segments) in an EDI file

The EDI templates in integrator.io are designed for single ST-SE segments within a single EDI file. If you are exporting an EDI file with multiple ST-SE segments, you can enable the conversion from the expected single ST-SE segment to multiple ST-SE segments at the source and destination flow steps:

  1. Add a file definition for parsing the exported records.

  2. Add a file definition for generating the imported records.

Similar logic applies if your EDI file has multiple sections of other types, such as GS-GE.

Sample file

The file definitions that follow assume this example 997 EDI file format containing two ST-SE segments as input or output:

ISA*01*0000000000*01*0000000000*ZZ*ABCDEFGHIJKLMNO*ZZ*123456789012345*101127*1719*U*00400*000003438*0*P*>~
GS*SH*4405197800*999999999*20111206*1045*49*X*004060~
ST*997*0008*3~ 
AK1*AA*49*001000~ 
AK2*997*001*REFNO~ 
AK3*BEG*01*1*1~ 
AK4*728*02*1*1*2~ 
AK5*R*1*2*3*4*5~ 
AK9*P*ER1*ER2*ER3*ER4*ER5*ERER6*ER7*ER8~ 
SE*8*0008~ 
ST *997*0009*3~
 AK1*SH*8150406~
 AK2*856*8150406~
 AK3*N3*2*N1*3~
 AK4*722*02*1*B1~
 AK5*R*1*2*2*4*2~
 AK9*P*2*2*1~
SE *8*0008~
GE*1*49~
IEA*1*000000049~

Export file definition

In Flow Builder, open the export that retrieves the EDI file. In the section How would you like to parse files?, click to launch the File parser helper.

In the resulting File parser helper Advanced field editor (AFE), define the records as demonstrated below to convert from single to multiple ST-SE segments, inside the "fileDefinition" field.

Note

Be sure to remove the /* comments */ below from your file definition to avoid parsing errors; they’re inline here to self-document the JSON.

{
  "name": "ST",
  "maxOccurrence": 10, /* Should be greater than 1 to handle multiple ST-SE*/ 
  "container": true,  /* Container must be true for handling multiple ST 
                        segments in  an array */ 
  "children": [   /* Add the elements, children, and closeRule of ST-SE in this 
                    object for repeating ST-SE segments */ 
    {
      "required": false,
      "skipRowSuffix": true, 
      "elements": [
        {
          "name": "ST",
          "value": "ST"
        },
        {
          "name": "Transaction Set Identifier Code",
          "value": "ST01"
        },
        {
          "name": "Transaction Set Control Number",
          "value": "ST02"
        },
       {
           "name": "Implementation Convention Reference",
           "value": "ST03"
        }
      ],
      "children":  [ ... ],  /* children of ST based on the specification*/ 
      "closeRule": { 
        "maxOccurrence": 1,
        "required": true,
        "elements": [
          {
            "name": "SE",
            "Value": "SE"
          },
          {
            "name": "Number of Included Segments",
            "value": "SE01"
          },
          {
            "name": "Transaction Set Control Number footer",
            "value": "SE02"
          }
        ]
      }
    }
  ]
}

Import file definition

Open the import that writes the EDI file. In the section How would you like to generate files?, click to launch the File generator helper.

In the resulting File generator helper AFE, define the records as demonstrated below to build an EDI file with multiple ST-SE segments. For multiple ST-SE segments, add the field "relativeDataPath" , giving your array name for its value, and set "maxOccurrence" greater than 1.

Note

Remember to remove the /* comments */ below from your file definition to avoid parsing errors; they’re inline here to self-document the JSON.

{
  "name": "ST",
  "description": "Transaction Set Header",
  "maxOccurrence": 10, /* > 1 to handle multiple ST-SE segments */ 
  "required": true,
  "relativeDataPath": "ST",  /* Provide the value per the array name */ 
  "elements": [
    {
      "name": "name",
      "value": "ST"
    },
    {
      "name": "Transaction Set Identifier Code",
      "value": "{{{[Transaction Set Identifier Code]}}}"
    },
    {
      "name": "Transaction Set Control Number",
      "value": "{{{[Transaction Set Control Number]}}}"
    },
    {
      "name": "Implementation Convention Reference",
      "value": "{{{[Implementation Convention Reference]}}}"
    }
   ],
   "children":  [ ... ],  /* Children of ST based on the specification */
   "closeRule": {
     "name": "SE",
     "description": "Transaction Set Trailer",
     "maxOccurrence": 1,
     "required": true,
    "elements": [
      {
        "name": "name",
        "value": "SE"
      },
      {
        "name": "Number of Included Segments",
        "value": "{{{[Number of Included Segments]}}}"
      },
      {
        "name": "Transaction Set Control Number(SE02)",
        "value": "{{{[Transaction Set Control Number]}}}"
      }
    ]
  }
}
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.