Say you will put all the files to import into Navision in a folder and one navision dataport will import all the files one by one into Navision.
Here is how I have done it –
Created a new form and put a text box where user can mention the folder path from where the files will be imported. Also put a command button which will start the import process clicked.
FileRec Record type -> referenced to virtual table ‘File’
CTR Integer type -> to count the number of files imported
TransImport Dataport type -> referenced to a dataport which will be run repeatedly depending on number of files present in the folder
FilePath Code type -> to store the file path of the folder
Also took a text constant for displaying the import progress in the dialog box ‘WIN’
Text50000 Importing File #1#####################Count of File #2#####
Once the definition of variables are done, write the following code in the OnPush trigger of the command button –
ImportButton – OnPush()
Now run the form and enter the folder path where your files to be imported are stored and click on the button ‘Import’. This will start the import process and will continue till all the files from the folder is imported into the database.
You can automate the same with the help of timer trigger of the form or using an application server. Will discuss the process of automating it in our future discussion.
All the best. Try it.