Rank: Member
Joined: 8/26/2017 Posts: 11 Location: UK
|
I have a fixed width text file where each record type is identified by the first character. Record type 1 are individual transactions and they are in batches, the details of the batch are record type 2. I need to map out this format using Flextext but the batch detail (record type 2) is a summary, i.e. sequentially it comes after the related transactions (record type 1), not at the beginning.
If I use the repeated split and set the "line starts with" as 2, then it orpans the first record 1s, then treats record 2 as the batch header, and includes the record type 1s which follow it - so the whole thing is wrong. See the first picture attachment.
What I need to do seems to be either, do a repeated split, "line starts with" 2 but in reverse, i.e. from the bottom up, or I probably have to reverse the order of the lines in the source file. The desired result is in the second screenshot / attachment.
Am I missing something? It can't be this difficult - any help / advice appreciated.
diggers attached the following image(s):
|
Rank: Advanced Member
Joined: 2/27/2009 Posts: 564
|
To start with, you want to try to get the right batches. This can be done without using FlexText, using the group-ending-with function as demonstrated by the following example.
To process the two different record types, pass each individual row into its’ own serialized string processing component. That is, create two FlexText components; one for each record type. Then, pass the complete individual row (as text) into each based on whether or not it starts with “2”.File Attachment(s): example.zip (4kb) downloaded 69 time(s).
K101 attached the following image(s):
|