Text import problems

I’m having problems importing text files that contain lines which exceed 1024 characters. As far as I can tell, you can only read from a text file one whole line at a time and yet you can only store 1024 characters in a text variable. For example: gvFile.OPEN(fpFileAndPath); gvFile.WRITEMODE := FALSE; gvFile.TEXTMODE := TRUE; gvFile.READ(gvOneLine); where gvOneLine is defined as Text (1024). The text file that I’m importing is not delimited in any standard way (EDI ODETTE file), so a Dataport won’t help. Any suggestions would be most appreciated. Bradley

Hi Bradley, As I see it, Your primary issue is how to get the text “inside” Navision. Use a Dataport. Create it as “Fixed width”. Define 3 text-vars as text10024. make sure that You do not miss any characters, or have the same character read twice for that matter, when you define start-position and length in the dataport-field form. This way You should be able to read 3072 characters. The following handling of the string, could be a bit more complicated, since the text is stored in 3 different vars, but should also be overcomeable (If there is such a word [:D]) regards Alexander

Bradley, you could also import the file in binary mode, character per character, the speed is ok, and there are no issues with the line length. gvFile.OPEN(fpFileAndPath); gvFile.WRITEMODE := FALSE; gvFile.TEXTMODE := FALSE; … this one should give you an idea: http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=4159 Saludos Nils

Thanks guys, I appreciate the quick response, I was expecting to have to wait at least a day. Both options sound plausible but I’ll need to investigate them to determine which will suit my needs better since I’ve already written the rest of the code(which involves a lot of parameter passing). I’ll probably stick with the one that requires the least amount of recoding. Once again, thanks a lot!!! Bradley

Good to hear that this forum did exceed your expectaionts, and glad to be able to help out. [;)] Saludos Nils