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

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top