Good morning,
I'm having problems with a txt file and do not understand the cause.
What I do is, once imported a file with a dataport, take it to a history folder and then clear the txt.
To take it a history folder I do the following:
vRutaConfiguracion: = 'C: \ test \ production \ entries';
vRutaOrigen: vRutaConfiguracion + = '\ file.txt';
vRutaDestino: vRutaNueva + = '\ file.txt;
File.Copy (vRutaOrigen, vRutaDestino)
Then I write:
OutFile.CREATE (vRutaOrigen)
(It is assumed that re-create that file, I overwrite the previous one and will remain empty)
But NAV sohows me this error:
"You can not access the file C: \ test \ production \ inputs \ file.txt"
That's just the path and I have to create file and folder permissions issues of windows is not.
0
Comments
I think you need this: 'C:\test\production\entries'.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
My Blog - nav.education
If another software writes to the file and assumes it does exist at all times I would not process the file directly then delete and recreate it (which might place a lock on the file for several seconds) but I would first rename the file and immediately create an empty file at the same place. Then you can do your processing on the renamed file while the other process can still write to "his" file.
FD Consulting
Text Constants:
FilePath -> I:\Data Feed\History\
Text0001 -> %1 Orders Imported / Would You Like To Delete The File?
OnAfterImportRecord()
OrderCount := OrderCount + 1;
OnPostDataport()
CurrFile.CLOSE; //Close the text file once done
IF CONFIRM(Text0001,TRUE,OrderCount) THEN BEGIN //ask what the next step should be
SavedFileName := FORMAT(WORKDATE,0,'<Year4>'+'-'+'<Month Text,3>'+'-'+'<Day,2>'+'-'+DELCHR((FORMAT(TIME)),'=',':'))+'.txt'; //create a History filename with date & time stamp.
FILE.COPY(CurrDataport.FILENAME,FilePath+SavedFileName); //Copy the orig file to the History directory
ERASE(CurrDataport.FILENAME); //erase the orig file
END;
http://www.BiloBeauty.com
http://www.autismspeaks.org