mibuso.com

Microsoft Business Solutions online community
It is currently Sun May 19, 2013 6:45 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: NAV 5.0 Operating system can not find file ... problem
PostPosted: Wed May 23, 2012 10:19 am 
Offline

Joined: Tue Oct 04, 2011 10:26 am
Posts: 94
Country: Belgium (be)
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
Code: Select all
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);


Last edited by Resender on Wed May 23, 2012 1:14 pm, edited 1 time in total.

Top
 Profile E-mail  
 
 Post subject: Re: NAV 5.0 Operating system can not find file ... problem
PostPosted: Wed May 23, 2012 10:39 am 
Offline

Joined: Mon Oct 24, 2011 2:58 am
Posts: 142
Location: Tokyo
Country: Japan (jp)
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 is


Top
 Profile E-mail  
 
 Post subject: Re: NAV 5.0 Operating system can not find file ... problem
PostPosted: Wed May 23, 2012 1:10 pm 
Offline

Joined: Tue Oct 04, 2011 10:26 am
Posts: 94
Country: Belgium (be)
Do I do this before or after I start reading files


Top
 Profile E-mail  
 
 Post subject: Re: NAV 5.0 Operating system can not find file ... problem
PostPosted: Wed May 23, 2012 3:26 pm 
Offline

Joined: Thu Oct 30, 2008 10:38 am
Posts: 987
Location: Earth
Country: Netherlands (nl)
Always before reading.

_________________
|Pressing F1 is so much faster than opening your browser|
|MCBMSS: 5.0 intro|MCTS:NAV09 839..841|JetReports© Certified Specialist|
|Dynamics Anywhere: Mobile Business Solutions|


Top
 Profile  
 
 Post subject: Re: NAV 5.0 Operating system can not find file ... problem
PostPosted: Thu May 24, 2012 11:26 am 
Offline

Joined: Tue Oct 04, 2011 10:26 am
Posts: 94
Country: Belgium (be)
Doesn't seem to works


Top
 Profile E-mail  
 
 Post subject: Re: NAV 5.0 Operating system can not find file ... problem
PostPosted: Thu May 24, 2012 4:36 pm 
Offline

Joined: Thu Oct 30, 2008 10:38 am
Posts: 987
Location: Earth
Country: Netherlands (nl)
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?

_________________
|Pressing F1 is so much faster than opening your browser|
|MCBMSS: 5.0 intro|MCTS:NAV09 839..841|JetReports© Certified Specialist|
|Dynamics Anywhere: Mobile Business Solutions|


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: