The integrator.io EDI parser supports the following functions:
This is the flag that can be set at element level. If we set the flag, the respective element will not be reflected on the parsed json output.
Definition
{
"required": true,
"skipRowSuffix": true,
"elements": [{
"name": "BH",
"value": "BH",
"length": 2
},
{
"name": "name",
"value": "{{name}}",
"length": 2,
"ignore": true
},
{
"name": "id",
"value": "{{id}}",
"length": 7
}]
}
Example
BH500B051820180105
Output
{
"id": "0B05182"
}
Although we had a second element as "name" with length set to 2 which will result in "50" from the given content, since element has ignored the flag that entry is being ignored in the json.
This is the flag we can set on a rule of a container if we cannot rely on the starting element as the identifier to recognise its repetition to gather them into an array structure.
Definition
{
"name": "Generic fixed-width",
"description": "Sample fixed width definition to test parser features",
"version": 1,
"format": "fixed",
"fixed": {
"rowSuffix": "~",
"rowDelimiter": "\n",
"paddingChar": "˙"
},
"rules": [{
"name": "file Header",
"required": true,
"elements": [{
"name": "HeaderRow",
"value": "HMAPIDCOMP",
"length": 10,
"ignore": true
}],
"children": [{
"name": "data",
"description": "This is a container",
"container": "true",
"required": true,
"maxOccurrence": 5,
"children": [{
"required": true,
"skipRowSuffix": true,
"elements": [{
"name": "BH",
"value": "BH",
"length": 2
},
{
"name": "name",
"value": "{{name}}",
"length": 2,
"ignore": true
},
{
"name": "id",
"value": "{{id}}",
"length": 7
}],
"children": [{
"name": "items",
"required": true,
"maxOccurrence": 100,
"container": true,
"children": [{
"required": true,
"skipRowSuffix": true,
"ignoreIdentifier": true,
"elements": [{
"name": "Id",
"value": "02",
"length": 3
},
{
"name": "id",
"value": "{{id}}",
"length": 4
},
{
"name": "descr",
"value": "{{qty}}",
"length": 4
}
]
}]
}],
"closeRule": {
"required": true,
"skipRowSuffix": true,
"elements": [{
"name": "BT",
"value": "BT",
"length": 2
},
{
"name": "qty",
"value": "{{qty}}",
"length": 2
}
]
}
}]
}],
"closeRule": {
"required": true,
"elements": [{
"name": "T",
"value": "T",
"length": 1
}]
}
}]
}
Example HMAPIDCOMP120228962120180105010520180005 BH500B051820180105 001500B0518 002500B0518 003500B051 010500B0518 011500B0518 012500B0518 BT060B05180150864900 In this kind of fixed-width file we cannot rely on starting tags to establish our container rule, for that purpose we have introduced this flag. Output { "data": [ { "id": "0B05182", "items": [ { "Id": "001", "id": "500B", "descr": "0518" }, { "Id": "002", "id": "500B", "descr": "0518", }, { "Id": "003", "id": "500B", "descr": "0518" }, { "Id": "010", "id": "500B", "descr": "0518" }, { "Id": "011", "id": "500B", "descr": "0518" }, { "Id": "012", "id": "500B", "descr": "0518" } ], "qty": "06" } ] }