FlatMapper
FlatMapper copied to clipboard
Custom parsing
Thanks for the great library.
I am trying to import a fixed width flat file (from COBOL no less) and I need to format some of the fields manually. For instance, the dates are YYYYMMDD. The decimal numeric fields have no placeholders and have a trailing negative like this: 5546 = 55.46, 123450- = (-)1234.50. So I need to manually parse certain fields. The app is in core 2 and I cannot for the life of me figure out how to get a custom formatter working with your code.
.WithMember(o => o.na_dist_dat, set => set.WithLength(8) ) -> "YYYYMMDD" to a datetime
Should I use .WithFormat and implement my own iFormat Provider?
Thanks
Hi,
Have you tried the WithMember(o => o-na_dist_dat, set => set.UseValueConverter<ValueConverterType>())
where your ValueConverterType
inherits from FieldValueConverter<DateTime>
I will check into that. In the meantime I moved to FileHelpers (they also have a bunch of handlers for very annoying COBOL text export standards). I much prefer your library so I will see if I can make it work.
Thanks for your preference, I do too, but I'm biased 😄
Anyway, that's the good of open source... you have options