-
Notifications
You must be signed in to change notification settings - Fork 64
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
Is it possible to configure a fixed length window to use a variable length? #90
Comments
Take a look at this section in the README: https://github.com/jehugaleahsa/FlatFiles#skipping-records Basically, you add an event handler to the reader that lets you look at and skip a row before it gets processed. Let me know if you run into any issues. |
Thank you, that's what I was doing initially but I was informed I need to load the comment records as well. It's a bit of a mess and I don't have control over the source format, nor the destination format. Sample file: COM This class has had multiple drop outs I have to load each record as the following entity
So, I have a List() and I'm using FlatFiles to parse each record of each file, and then add it to the list.
If I set the window for the comment arbitrarily small, then it works but obviously it truncates the comments. If I skip the comment records, it also works but it skips the comment records. If I set it as a delimited file, then the space would break up every record... unless a delimitedtypemapper has the ability to 'combine' all trailing fields into a single field? ~Edit:
The FixedLengthMapperSelector will skip all records starting with "COM" and the DelimitedTypeMapper will skip all records with Values.Length < 2 Again, it's really janky but it works unless you have a better idea. |
Not sure what's preferred, editing the original or adding another comment, but I believe I have found a solution with Window.Trailing.
Initial tests have this working. Thanks for such an excellent and configurable product! |
I know the question sounds stupid, but I'm facing a challenge where some record formats are of a variable length.
Essentially, I have a file with multiple record formats, most of which are fixed length with a space between each field, however there is also a comments record type. The comments record type is identified by starting with a COM, and then the comment is the remainder of the line. So..
COM This is the comment
COM This is also a comment
Those lines are not space padded up to a defined length.
I've used the FixedLengthTypeMapperSelector to be able to map the various fixed length fields to their own classes, but I'm struggling to figure out a configuration to accommodate the comment record types. In reading the code, it looks like this might be possible as is with the Trailing window, but I'm not sure how to configure it.
The text was updated successfully, but these errors were encountered: