Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom parsing #8

Open
picasso566 opened this issue Apr 16, 2018 · 3 comments
Open

Custom parsing #8

picasso566 opened this issue Apr 16, 2018 · 3 comments

Comments

@picasso566
Copy link

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

@joaomatossilva
Copy link
Owner

Hi,

Have you tried the WithMember(o => o-na_dist_dat, set => set.UseValueConverter<ValueConverterType>())

where your ValueConverterType inherits from FieldValueConverter<DateTime>

@picasso566
Copy link
Author

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.

@joaomatossilva
Copy link
Owner

Thanks for your preference, I do too, but I'm biased 😄

Anyway, that's the good of open source... you have options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants