delete txt file after import

hawwa
Member Posts: 106
Dear all,
I have a dataport to import data from a text file. How do I delete the text file after importing all the file.
Thank You,
hawwa
I have a dataport to import data from a text file. How do I delete the text file after importing all the file.
Thank You,
hawwa
0
Comments
-
Put the following Code in the OnPost Dataport Trigger
WHILE EXISTS((CurrDataport.FILENAME)
DO ERASE(CurrDataport.FILENAME);
The WHILE -DO Statement is safer than IF-THEN.Kai Kowalewski0 -
Hi Kowa,
you don't trust Windows too muchhttp://www.NaviTools.com
Documentation for Microsoft Navision
E/R diagrams, Workflow diagrams, UML diagrams, process diagrams0 -
The Windows file deletation is ok, but the Navision - Windows interaction is
not on all terms "state-of-the-art."
The precaution stated above comes from experience, not from prejudice.
Our customers have imported hundreds of dataport files. Every once in a while, the file deletion did not work, where WHILE-DO wasn't used, for no apparent reason. Better play it safe, this will save you time and money correcting the nasty impacts of double imports.Kai Kowalewski0 -
Kowa wrote:Put the following Code in the OnPost Dataport Trigger
WHILE EXISTS((CurrDataport.FILENAME)
DO ERASE(CurrDataport.FILENAME);
The WHILE -DO Statement is safer than IF-THEN.
I get the Error Message:
You cannot use the file Z:\ABC.txt because it's already in use.
What I'm shooting for is a pop-up that says - Import Completed would you like to delete the file Y/N.0 -
Ok this works better
CurrFile.CLOSE;
ERASE(CurrDataport.FILENAME);
Gotta Close the file first.
I didn't start the thread so I cannot add [Solved] :roll:0 -
Savatage wrote:What I'm shooting for is a pop-up that says - Import Completed would you like to delete the file Y/N.
And of course you need to add theCurrfile.close IF Confirm(Text000, true) then erase(...
Where Text000 = 'Would you like to delete the file?'
Succes.0 -
I've noticed you sure are quick on reply's!! 8)
Nobody else has a chance0 -
I just post a message if I think know the answer, thats all.0
-
-
-
-
Guys, I am just an ordinary guy from holland trying to have a little fun and distraction on this forum.
If you have any problems, please let me know. Preferably by email, or pm.0 -
No problems here, just a little fun at your expense :whistle:. Didn't mean to get your panties in a bunch, and I am sorry if I did. Your (and everybody else's) help is greatly appreciated, trust me.0
-
Mark Brummel wrote:Guys, I am just an ordinary guy from holland trying to have a little fun and distraction on this forum.
If you have any problems, please let me know. Preferably by email, or pm.
It was all light hearted, sorry if you took it wrong O:)0 -
-
OK then...
[Solved]
Put the following Code in the OnPost Dataport Trigger
CurrFile.CLOSE;
IF Confirm(Text000, true) then
ERASE(CurrDataport.FILENAME);
Where Text000 = 'Would you like to delete the file?'
Thanks to all \:D/0 -
Alrighty then... Hawwa or Luc, please put the [solved] thingy in the subject0
-
There was a national holiday yesterday here so I couldn't take part in the chatting
, but specially if the import file is on a network drive I would prefer :
CurrFile.CLOSE;
IF Confirm(Text000, true) then
WHILE EXISTS(CurrDataport.FILENAME)
DO ERASE(CurrDataport.FILENAME);Kai Kowalewski0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions