File object not being cleared

Alex_ChowAlex_Chow Member Posts: 5,063
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

Sign In or Register to comment.