Question

I've to parse a fixed length file containing multiple line but with different length. Actually each line represent a different kind of object that would be insert in the database. The file can be like this:

A10200JohnSmithUSA B10000ContractSignedWithJohnSmith10200

Line 1..represent information regarding John Smith and Line 2 represents informations regarding contract signed by JohnSmith... All this come in the same file.

Can filehelpers library do that?

Thanks for your help. Regards

Was it helpful?

Solution

Yes FileHelpers can handle multiple record types within the same file. It depends whether there is any hierarchical relation between the records. If not, you can use the MultiRecordEngine.

Check out the MultiRecordEngine example

If your contract row needs to use information from the John Smith row, then you can use a MasterDetailEngine.

Check out the MasterDetailEngine example

Note however, the MasterDetailEngine only supports one level of nesting.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top