Import File

Hello, and happy eastern :wink: I have a question like this : How can i read a textfile into Navision. I will read the file line per line. Can anyone help me ?! Maybe can give me a little example ?! ------------ Best regards Alejandro Schubert schubert@dolphinct.de

This can be very complicated work. If the source file has line longer than 250 chars and you want to save it into Navision Text field, you have to develop some clever procedure to do this. I have spent some time on that, when I tried to import e-mail message from Outlook into Navision comment table. I had to create function, that read file char by char, then compose words from characters and wrapped lines to desired length (shorter than 250 chars). If input file line is shorter, then it is simple task. I did not test it, but I think, that something like this could work: InputFile.OPEN(InputFileName); while InputFile.READ(TempTextVariable) > 0 then WriteNewRecordSomewhere(TempTextVariable); end; InputFile.CLOSE; Michal

You might want to start with: inputfile.TEXTMODE := TRUE; to open the file in textmode. It will read characters instead of lines if you don’t. Dennis van Es PerCom: Research & Development BV The Netherlands

Basically, you can create a nonprinting report to go through the file line by line till you run out of lines. If the lines are less than 250 characters long, you can read each line into a text variable. Your dataitem for the report should be the Integer table, NOT the table you’re reading the data into. Basically, for each integer, your report does four things: 1. Read in the next line of text. 2. Parse the data. 3. If the data is valid, and if the line is not blank, not a header, etc. then: write the data to an appropriate Navision table. This is a gross oversimplification, of course :slight_smile: If you use one Integer dataitem, the import will crash when it runs out of integers— but you have over 2 billion (2,000 million) integers to work with! Hopefully no one expects you to parse a text file with over 2 billion lines of text in it— and if they do, you can add a second datatitem, which means you can then parse text files with more than 4 million million lines of text in them. --Tim Horrigan Horrigan@emsolution.com> ------- Tim Horrigan

Seems to me that no-one has heard of DATAPORTS… Dennis Decoene Navision Developer Top-IT Molenhuisstraat 2a 9800 Deinze Belgium

Hi Alex, Check the Navision Financials Merge tool, they’re some nice routines there to read lines from a file which are bigger than 250 chars. tarek_demiati@ureach.com