FlatFiles icon indicating copy to clipboard operation
FlatFiles copied to clipboard

Support Ragged Right or Ignore To End of Line

Open ithielnor opened this issue 4 years ago • 3 comments

Is your feature request related to a problem? Please describe. Sometimes the files we get may have schema changes that we are not informed of with new columns added to the end of the file. It would be nice if we could simply ignore everything beyond the last mapped column, or shunt it all into one mapping.

Describe the solution you'd like There are two potential options here:

mapper.RemainderIgnored(); // for separated value mappers, ignore all remaining columns
mapper.RaggedRightProperty(x => x.Property); // for fixed width mappers, push all remaining data on the line into a single property.

Describe alternatives you've considered Currently I must map every column, even if I don't care about it.

Additional context

ithielnor avatar Jul 30 '19 18:07 ithielnor

This is a great idea. Today, I think I accept extra data being on the end of delimited and fixed width files, but I just end up throwing it away. It would be great to introduce a configuration setting to specify how you want to handle these: throw an exception, throw away the extra stuff or keep it in the results somehow.

For delimited, you would have a an array of strings, basically. I could allow you to access those properties in a custom mapper.

For fixed-width, you would just have a single string. Similarly, I could allow access to it in a custom mapper.

jehugaleahsa avatar Jul 31 '19 16:07 jehugaleahsa

I didn't know you accepted trailing data. I seem to recall I got an error when our mapping didn't match the file layout. Maybe that was a few versions back, so I'll have to retest.

I like your suggested solutions too.

ithielnor avatar Jul 31 '19 17:07 ithielnor

It might still throw, but I'm not sure. It's worth taking a look.

On Wed, Jul 31, 2019, 1:04 PM Joel Potter [email protected] wrote:

I didn't know you accepted trailing data. I seem to recall I got an error when our mapping didn't match the file layout. Maybe that was a few versions back, so I'll have to retest.

I like your suggested solutions too.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jehugaleahsa/FlatFiles/issues/58?email_source=notifications&email_token=AAKOAPQKPT2V5TFEQNYHQ3DQCHAYRA5CNFSM4IH7KTY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3H5BLY#issuecomment-516935855, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKOAPRF3BUZCAIYSV653NDQCHAYRANCNFSM4IH7KTYQ .

jehugaleahsa avatar Jul 31 '19 17:07 jehugaleahsa