NAV 5.0 Operating system can not find file ... problem

Resender
Member Posts: 119
Hello all, I'm working on a project where I have to read several txt or csv files into the Nav 5.0 environment.
All the code works like a charm but the one problem I keep encountering is when I want to debug or run the codeunit a second time
But if I want to rerun it for a second time I get the error it cannot find the file from the previous run
Here is the code
All the code works like a charm but the one problem I keep encountering is when I want to debug or run the codeunit a second time
But if I want to rerun it for a second time I get the error it cannot find the file from the previous run
Here is the code
bolProcessed := FALSE; CLEAR(lrecFile); lrecFile.RESET(); lrecFile.SETRANGE(Path,txtPathIn); lrecFile.SETRANGE(lrecFile."Is a file",TRUE); IF lrecFile.FIND('-') THEN REPEAT txtPONummer := ''; bolOKFile := TRUE; txtFileName := lrecFile.Name; logFile.CREATE(txtLogMap + 'Log_' + ShortFileName(txtFileName) + '_' + DELCHR(FORMAT(TODAY),'=','/\: ') + '_' + DELCHR(FORMAT(TIME),'=','/\: ') + '.txt'); logFile.CREATEOUTSTREAM(OutstreamObj); writeLog(txtFileName); writeLog('------------------------'); IF bolOKFile THEN ProcessFile(lrecFile); logFile.CLOSE; // UNTIL lrecFile.NEXT = 0; CLEAR(lrecFile);
0
Comments
-
You need to change the Path to refresh the virtual table File.Microsoft Certified IT Professional for Microsoft Dynamics NAV
Just a happy frood who knows where his towel is0 -
Do I do this before or after I start reading files0
-
-
Doesn't seem to works0
-
lrecFile.RESET();
lrecFile.SETRANGE(Path,ROOT);
lrecfile.findset;//if your root doesn't contain any files or folders it will error, but seriously if your root doesn't have any files/folders, something else is wrong
lrecFile.RESET();
lrecFile.SETRANGE(Path,txtPathIn);
lrecFile.SETRANGE(lrecFile."Is a file",TRUE);
Does this work?0
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