Dataport multiple files

I need to import multiple files. Does anyone know of a way to run a dataport for all of the .txt files in a specific directory? In the directory are multiple files with different filenames, but all have the .txt extension. Edited by - SimonMc on 2/3/00 9:32:58 PM

You should be able to write a codeunit, using several dataports after each other, using the function DATAPORT.RUN: “Use this function to load and execute the dataport you specify. If, at design time, you do not know the specific dataport you want to run, use this function or the DATAPORT.RUNMODAL function. If you do know the specific dataport you want to run, you can use the d.RUN function or the d.RUNMODAL function. DATAPORT.RUN(Number [, ReqWindow] [, Record])” But you have to set the filename+path in the properties of the dataports, so the filenames have to be the same all the time. Joerg R Feldhofen KUMATRONIK Business Solutions Houston, TX

The filenames have not to be the same all the time, you can use Navision virtual table File. You need to set filter on the field Path and that table will contain all files in this directory. Then you can use REPEAT UNTIT to import all files. Valentin Gvozdev

Valentin, you are right if there is one dataport, importing files that have all the same structure. But maybe Simon has to import several files with different data and different dataport. So he is able to choose which method is appropriate… Joerg R Feldhofen KUMATRONIK Business Solutions Houston, TX

The files I need to import have the same structure. I use the same dataport for each file. The method Valentin suggested works. Thanks!

Checkout these links - http://dynamicsuser.net/forums/p/10471/53212.aspx#53212 or http://navisioncanbefun.blogspot.com/2008/08/sequential-import-of-multiple-files.html