Examples: Parsing Inbound Floating Records
When the pub.flatFile:convertToValues service receives a document that includes floating records, the parser handles them as shown in the following examples. Assume that the Floating Record property is set to the record NTE.
Example 1
Flat file schema definition | Input EDI document | Output IS document |
Rec1 NTE[] Max Occurs 99 Rec2 Rec3 Rec4 Rec5 | Rec1 Rec2 Rec3 Rec4 NTE (1) NTE (2) NTE (3) Rec5 | Rec1 NTE [] NTE (1) NTE (2) NTE (3) Rec2 Rec3 Rec4 Rec5 |
In accordance with the schema definition, the parser creates an NTE array as the first record, and places NTE (1), NTE (2), and NTE (3) into it. A validation error is generated if more than 99 NTE records appear in the document. NTE records are not allowed prior to the Rec1 record.
Example 2
Flat file schema definition | Input EDI document | Output IS document |
Rec1 NTE [] Max Occurs 99 Rec2 [] Max Occurs 99 NTE [] Max Occurs 99 Rec3 Rec4 Rec5 | Rec1 NTE (1) Rec2 Rec3 NTE (2) Rec4 NTE (3) Rec2 NTE (4) Rec5 NTE (5) | Rec1 NTE [] NTE (1) NTE (5) Rec2 [] Rec2 NTE [] NTE (2) NTE (3) Rec3 Rec4 Rec2 NTE [] NTE (4) Rec5 |
How Example 2 was Parsed
1. The first six records of the EDI document were parsed as follows:
Input EDI document | Output IS document |
Rec1 NTE (1) Rec2 Rec3 NTE (2) Rec4 | Rec1 NTE [] <== NTE container for Rec1. NTE (1) Rec2 [] Rec2 NTE [] <== NTE container for Rec2 array. NTE (2) Rec3 Rec4 |
a. The positions of the first three records (Rec1, NTE (1), and Rec2) match the schema. In accordance with the schema definition, the parser:
Creates an NTE container (an array) under
Rec1, and places
NTE (1) into it.
Creates a
Rec2 array, and places
Rec2 into it.
b. Even though the schema definition says the next record should be an NTE (followed by Rec3), the next record in the document is Rec3 (followed by NTE (2)). This is valid; the parser simply:
Places
Rec3 into the
Rec2 array, as specified in the schema definition.
Creates another NTE container (an array) under
Rec2, as specified in the schema definition. To determine which container to put
NTE (2) in, he parser looks for the last defined container at the current level. Thus, the parser places
NTE (2) in this container.
c. The parser places the next record, Rec4, in the Rec2 array, in accordance with the schema definition.
2. Parsing NTE (3):
Input EDI document | Output IS document |
Rec1 NTE (1) Rec2 Rec3 NTE (2) Rec4 NTE (3) | Rec1 NTE [] NTE (1) Rec2 [] Rec2 NTE [] NTE (2) NTE (3) <== added to this container at current level Rec3 Rec4 |
To determine which container to put NTE (3) in, the parser looks for the last defined container at the current level. Thus, the parser places NTE (3) in the same container as NTE (2).
3. Parsing Rec2 and NTE (4):
Input EDI document | Output IS document |
Rec1 NTE (1) Rec2 Rec3 NTE (2) Rec4 NTE (3) Rec2 NTE (4) | Rec1 NTE [] NTE (1) Rec2 [] Rec2 NTE [] NTE (2) NTE (3) Rec3 Rec4 Rec2 NTE [] <== creates an NTE container for second Rec2 NTE (4)
|
In accordance with the schema definition, the parser adds another Rec2 to the Rec2 array. Just as with the first Rec2 in the array, the parser also creates another NTE container, for the second Rec2.
4. Parsing Rec5 and NTE (5):
Input EDI document | Output IS document |
Rec1 NTE (1) Rec2 Rec3 NTE (2) Rec4 NTE (3) Rec2 NTE (4) Rec5 NTE (5) | Rec1 NTE [] NTE (1) NTE (5) <== this container is same level as Rec5 (current level) Rec2 [] Rec2 NTE [] NTE (2) NTE (3) Rec3 Rec4 Rec2 NTE [] NTE (4) Rec5 |
a. In accordance with the schema definition, the parser places Rec5 under Rec1.
b. To determine which container to put NTE (5) in, the parser looks for the last defined container at the current level. Thus, the parser places NTE (5) in the same container as NTE (1).