Hi all, I use dataport to import a txt file and I want to delete the contents of the file after import, is this possible? Do you have any suggestions? I have tried to delete the whole file by using the f.erase(‘file.txt’) in OnPostDataItem but I get the errormessage: ‘file is in use’. Another question; Do you know where I can find information about NAS and automation(the use of it)? I have already read most topic regarding on the forum,also the online help(communication components)… Didn’t get the grip of it… TiA,
Try This Dataport - OnPostDataport() CurrFile.CLOSE; ERASE(CurrDataport.FILENAME);
Thanx:) Had to be CurrFile.CLOSE;ERASE(‘C:\Navision\tempus3.txt’);
Try to store the CurrFile.NAME in a text variable and delete the file using that variable after closing the file. I mean your’s is working but hardcoded filenames are always bad practice [;)]
Hi Thomas:) Thanx for pointing out to me what I should have thougth about! Hard code is never a good thing…[xx(] Since you’re always so kind to answer my ignorant questions [:I], maybe you can tell me if it is possible to import two different files through a DataPort? (Without making one file out of their contents) Regards,