Delete Imported File After Successful Dataport Run
JohnieG
Member Posts: 56
Hi to all,
I am trying to delete a file (which is also the dataport's file) after running an importing dataport and I am getting the following message: "You cannot use file c:\myfile.txt because it is already in use". I believe that this is because the code for deleting the file is placed on the PostDataport Trigger which is being executed while the imported file is still open. ](*,)
Is there any way that I can delete this file with code from inside the dataport? Am I doing something wrong or is this impossible?
I am trying to delete a file (which is also the dataport's file) after running an importing dataport and I am getting the following message: "You cannot use file c:\myfile.txt because it is already in use". I believe that this is because the code for deleting the file is placed on the PostDataport Trigger which is being executed while the imported file is still open. ](*,)
Is there any way that I can delete this file with code from inside the dataport? Am I doing something wrong or is this impossible?
Always Look On The Bright Side Of Life...
0
Answers
-
Did you try file.close?0
-
Text0001 ='Would You Like To Delete The File?'
OnPostDataport BEGIN CurrFile.CLOSE; IF CONFIRM(Text0001,TRUE) THEN ERASE(CurrDataport.FILENAME); END;0 -
It worked perfect.
Thank you both for your quick and apposite remark! =D>
I have much to learn...Always Look On The Bright Side Of Life...0 -
You can easily Add more info like the # of Records Imported
OrderCount = Variable Type Integer
Text0001 = %1 Orders Imported / Would You Like To Delete The File?OnPreDataport() OrderCount := 0; //initialize the count
OnPostDataport() CurrFile.CLOSE; IF CONFIRM(Text0001,TRUE,OrderCount) THEN ERASE(CurrDataport.FILENAME);
OnAfterImportRecord() OrderCount := OrderCount + 1; //counts # of records
-Thanks to Mark Brummel for helping me with this many moons ago =D>
http://www.mibuso.com/forum/viewtopic.php?t=87530
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions