I am having a problem with using the File record.
I have a report that is aiming to go through a certain folder and for each text file in that folder process it into Navision and archive it.
The report has one data item, of type File. This has the following Table View:
SORTING(Path,Is a file,Name) ORDER(Ascending) WHERE(Is a file=CONST(Yes))
OnPreDataItem I am setting a range on the folder based on a field on the Request form as follows
SETRANGE(Path,Filepath);
This works fine the first time it is run, however it is as if the values in the File table are cached - If the first run has archived all files out of the folder, on the second run it attempts to process the same files again. If I compile the report, the File variable seems to be 'refreshed' and it will correctly process nothing.
Also, if it is processed when there are no files in the source folder, and files are subsequently added, these are not picked up until I have compiled the report.
Is there a way to refresh the File table OnPreReport so that it provides an up-to date view? I have tried to RESET or CLEAR the variable, creating a second file variable and doing the same SETRANGE and then FIND('-') and FIND('+') and inserting a SLEEP(1) to give control back to the OS, none of which have worked. Any ideas would be appreciated.
Thanks
0
Comments
Don't know if this will work but try using SELECTLATESTVERSION
on InitReport
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Inserting the following OnPreReport fixed the problem.
CashReceiptFiles.SETRANGE(Path,ENVIRON('Temp'));
IF CashReceiptFiles.FIND('-') THEN;
If you set a range on a different directory it refreshes the list. ENVION('Temp') is all I could think of that would always exist (ie some citrix users may not have a c:\, but navision always has a temp folder)
RIS Plus, LLC
http://home.casema.nl/mvandermeij
SETRANGE(Path, OtherPath);
SETRANGE(Path,Filepath);
www.mibuso.com
www.navision-girl.com
www.dynamicsuser.net