FlatFile
FlatFile copied to clipboard
Allow gaps with [FixedLengthField]
I am parsing using IFlatFileMultiEngine and [FixedLengthField] attributes.
There is a number of fields I don't care about. I thought I could just define the fields I need, simply skipping the irrelevant ones, like this:
[FixedLengthField(1, 10)]
public string ClientId { get; set; }
[FixedLengthField(100, 50)]
public string Address { get; set; }
I'd expect the 'gap '(data in positions 11..99) to be ignored. However, it looks like the 'index' parameter isn't used in the this case, and Address would start from 11 rather than 100.
I understand that index indicates the field order rather than representing the starting position on the line.
Try creating a gap field just to skip data, like in the example below:
[FixedLengthField(1, 10)]
public string ClientId { get; set; }
[FixedLengthField(2, 90)]
public string Gap01 { get; set; }
[FixedLengthField(3, 50)]
public string Address { get; set; }
It seems really silly to have to map this to a dummy property when you really just want to ignore the data. One of the claimed benefits of this library is speed, but you are forcing us to process and allocate data that we don't care about.
This part is particularity odd. Having to include gaps for parsing is really really weird. Please fix, (pretty please) 👍