FlatFile icon indicating copy to clipboard operation
FlatFile copied to clipboard

Allow gaps with [FixedLengthField]

Open valentynpopov opened this issue 9 years ago • 3 comments

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.

valentynpopov avatar Oct 20 '16 14:10 valentynpopov

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; }

mniak avatar Dec 20 '17 10:12 mniak

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.

ejsmith avatar Feb 23 '18 16:02 ejsmith

This part is particularity odd. Having to include gaps for parsing is really really weird. Please fix, (pretty please) 👍

kfrancis avatar Jun 25 '18 20:06 kfrancis