Hi Guys,
I'm running into a problem that I'm scratching my head over. Any help would be appreciated.
I have a process running using the OnTimer trigger in version 4.0SP1. The problem is that the file variable does not get cleared and seems to "capture" the contents of a directory at a point when the client is being ran. So new files are not being processed and the loop is always looping through the files already processed.
The question is, how do I clear the file variable so it gets the current contents of that folder?
Here's the code:
FileObject.RESET;
CLEAR(FileObject);
FileObject.SETFILTER(Path,'%1',TempPath);
FileObject.SETFILTER(Name,'ORDER-*');
FileObject.SETRANGE("Is a file",TRUE);
IF FileObject.FIND('-') THEN
REPEAT
TargetFilea := FileObject.Path + FileObject.Name;
IF FILE.EXISTS(TargetFilea) THEN BEGIN
<Runs a dataport pointing to TargetFilea>
<Move the processed file into a separate folder>
END;
UNTIL FileObject.NEXT = 0;
Answers
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Really? I searched and searched but couldn't find any thread on this.
When you said set another filter, can you elaborate? Do you mean change up the filter everytime the process is ran?
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
Just a happy frood who knows where his towel is
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book