I am working on a project developing automated text file importing using the Navision Application Server. Because you cannot use dataports with the NAS, I have written codeunits to handle the task of importing, parsing and creating records with my delimited text files.
Right now I'm trying to use a global variable with a data type of Variant to read the file data into...
REPEAT
CLEAR(ImportBuffer);
CatalogImportFile.READ(ImportBuffer);
//Call file handling functions to work with the ImportBuffer global here
//Insert Records here, etc.
UNTIL CatalogImportFile.POS = ImportFileLen;
Is there a better way to do this? I'm sure that someone else has tried to use the NAS to automate regular imports.
Thanks in advance!
CtrlShiftF11 ](*,)
Answers
This works fine for me and is a lot faster than a dataport when importing large amounts of data
I should have been more specific, my real question is...
In TEXTMODE should I be reading each line of the file data into a data type of VARIANT?
[-X
Thanks,
CtrlShiftF11
No, you can just use a text variable, just make it a big one.
What is the delimiter you are using?
Anyway, I've about got this perfected so I'll post the source code when I'm done testing and refining in case some other poor fool runs into this very issue.
\:D/
This is kind of rough but you get the idea. I'll post any enhancements once I get finished completely testing and refining this solution. :-k
I'm having the same problem regarding dataports and NAS. I am looking at this and I don't understand what is going on with:
ColDelimiter := '|';
TextQualifier := '^';
Is this not supposed to be a tab delimited file (which I'm using too), why do you use the above characters? Do you not use e.g. Char := 9; for the Tab or something? Could anyone shed some more light on this?
Many Thanks