Hello,
I have this scenario. Wherein the file will be copied thru the network into a map computer directory, and then navision will process the file after detecting it. The question is, is there any function in navision to check if the transfered file is already complete done?
Navision noob....
0
Answers
1) the procedure that moves the file must rename it when it is finished (ex. putting ok at the end of the file). And NAV only reads those files.
2) Let NAV change the name (ex. putting ok at the end of the file). If the file is locked, the file will NOT be renamed. Then let NAV only read records that are renamed.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Thanks for your tricks. But I have some difficulties in using those.
From your :
1. Transfering of file is done just by "copy and paste" or via FTP. So no other application is connected in transfering the file.
2. How can I know from nav the the file is Locked? Because I have already use the FILE.OPEN function and actually it can open the file even though the file is still in the process of transfering.
2. Use virtual table "File" to find the files in the subdir. Once you find a file, rename it, but do NOT open the file. If it succeeds, it means the file was not locked. After this, you can open the renamed file.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
1. Yeah.
2. What will I used? the FILE.RENAME? or send a command to the windows Command line?
Again, thanks for your suggestions.
you can set write mode to true and then try opening file in the loop. If the file is locked you should get an error. You can make some code like this:
f.WRITEMODE(true);
while not f.open(FileName) do
sleep(1000);
Best regards,
Damir
Also the solution of damir can be used. But I do not prefer it because if you only need to read a file, why open it to write? Another reason is that I have done a lot of interfaces and always I found that at the end the file is renamed to make it available (and sometimes another file is created to let see the first file is not locked any more, but this is not a really good way).
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Thanks a lot for providing this solutions. I really appreciate it. :thumbsup: