-2

I have a text that is more or less like this:

I10JOAO OF SILVAI202210I30 ...

where : I10 is a key to the Person class I20 is a key to another class so on ...

How to proceed using the FileHelpers library?

1 Answers1

0

Personally, I would suggest that you pre-parse the file into a temporarily file containing multiple lines which have the |10, |20, |xx prefix then use the record selection techniques described in the Avanced - Multi Record Selection.

netniV
  • 2,328
  • 1
  • 15
  • 24
  • The problem is that the file has only one line, and this line I identify the record by a key. example: Where the record "I10000" after it I have:         [FieldFixedLength (4)]          public string TipoRegistro;          [FieldFixedLength (2)]          public string subtype;                   [FieldFixedLength (70)]          [FieldTrim (TrimMode.Both)]          public string Name; `code`          [FieldFixedLength (8)]          [FieldConverter (ConverterKind.Date, "DDMMYYYY")]          public DateTime DataConfirmacao; – Glauber Victor Sep 22 '15 at 16:43
  • This is why I'm saying pre-parse it to split out by the key values. Then import with File Helpers. – netniV Sep 22 '15 at 16:45
  • Example: I10000GHERSON DYWYNO ESPHYNDOLA 2902198062903201200 I10100MOME MAE A900002024 NADA CONSTA PARA O CPF CONSULTADO – Glauber Victor Sep 22 '15 at 16:50
  • I could make a change in FileHelpers and implement the research? [FixedLengthRecord (FixedMode.AllowMoreChars, "I10000")]      public class X { } – Glauber Victor Sep 22 '15 at 16:52
  • Ok your example gives one line but how you do you expect that broken up ? What signifies the next record ? – netniV Sep 22 '15 at 16:55
  • I10000 class X { properties... } I10100 class X2 { properties... } A90000 class X3 { properties... } – Glauber Victor Sep 22 '15 at 16:58
  • Then yes, do what is suggested and write some code to pass over the file to separate out each line by splitting the single one. Then with the new output use filehelpers multi record options. It will be far easier in the long run. – netniV Sep 23 '15 at 00:15