Multiline + repeated segments

30 views
Skip to first unread message

Sandy R

unread,
Mar 9, 2021, 5:33:16 AM3/9/21
to beanio-users
Hi everyone,

I would like to know if the following caseis handled by beanio :

I have a fixedlength file with multiline records : a header (H) followed by repeated lines (D) of data that are themselves made of repeating segments : 

HXXXXXXXXXX
DAAAAAAAABBBBBBBBCCCCCCCCEEEEEEEE
DMMMMMMFFFFFFFFFNNNNNNNZZZZZZZZ
DPPPPPPPPIUUUUUUUUVVVVVVVVXXXXXXXX

With the segments (Item) being : 
AAAAAAAA
BBBBBBBB
CCCCCCCC
EEEEEEEE

(Item has actually several fields)

At the end I would like to get an object with like :

@Group
public class Document {

       @Record
        private Header header;

       @Record
       private List<Item> data;
}


At the very least, I'm trying to find out how to construct a Data object with a collection of segments from a single data line like below if iI have to handle the lines separatly : 

@Record
public class DataLine {
       @Segment
        List<Item> postes;
}

@Record
public class Item{
       @Field( at = 1, length = 4)
        (...)

        @Field(at = 5, length = 5)
        (...)
}

The above gives me an object with only the first item in the list.
Removing the positions throws an error : 

"position must be declared for all the fields in a record, or for none of them (in which case, all fields must be configured in the order they will appear in the stream)"

Thank you for your input

Reply all
Reply to author
Forward
0 new messages