mibuso.com

Microsoft Business Solutions online community
It is currently Thu May 23, 2013 2:54 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: [Solved] File object not being cleared
PostPosted: Thu Jul 19, 2012 1:20 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Fri Jun 11, 2004 9:05 pm
Posts: 4858
Location: Los Angeles, CA
Country: United States (us)
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:

Code: Select all
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;

_________________
Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work


Last edited by Alex Chow on Thu Jul 19, 2012 10:08 pm, edited 1 time in total.

Top
 Profile E-mail WWW  
 
 Post subject: Re: File object not being cleared
PostPosted: Thu Jul 19, 2012 1:44 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Wed Dec 15, 2004 6:11 pm
Posts: 8700
Location: 3rd rock from sun
Country: United States (us)
this is a known bug and discussed many times on mibuso. You need to set another filter and then nav will look at the folder again.

_________________
Rashed.

blog: http://mibuso.com/blogs/ara3n/


Top
 Profile  
 
 Post subject: Re: File object not being cleared
PostPosted: Thu Jul 19, 2012 1:52 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Fri Jun 11, 2004 9:05 pm
Posts: 4858
Location: Los Angeles, CA
Country: United States (us)
ara3n wrote:
this is a known bug and discussed many times on mibuso. You need to set another filter and then nav will look at the folder again.


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?

_________________
Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work


Top
 Profile E-mail WWW  
 
 Post subject: Re: File object not being cleared
PostPosted: Thu Jul 19, 2012 1:59 am 
Offline

Joined: Mon Oct 24, 2011 2:58 am
Posts: 142
Location: Tokyo
Country: Japan (jp)
ara3n is right. I've seen quite a lot of posts about this before. basically you need to change the filter 'path' before you do FIND. This is needed to refresh the folder.

_________________
Microsoft Certified IT Professional for Microsoft Dynamics NAV

Just a happy frood who knows where his towel is


Top
 Profile E-mail  
 
 Post subject: Re: File object not being cleared
PostPosted: Thu Jul 19, 2012 2:03 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Wed Dec 15, 2004 6:11 pm
Posts: 8700
Location: 3rd rock from sun
Country: United States (us)
Code: Select all
FileObject.reset;
FileObject.SETFILTER(Path,'%1','c:\');
FileObject.SETRANGE("Is a file",TRUE);
IF FileObject.FIND('-') THEN;

FileObject.reset;
FileObject.SETFILTER(Path,'%1',TempPath);
FileObject.SETFILTER(Name,'ORDER-*');
FileObject.SETRANGE("Is a file",TRUE);
IF FileObject.FIND('-') THEN
.....

_________________
Rashed.

blog: http://mibuso.com/blogs/ara3n/


Top
 Profile  
 
 Post subject: Re: File object not being cleared
PostPosted: Thu Jul 19, 2012 10:08 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Fri Jun 11, 2004 9:05 pm
Posts: 4858
Location: Los Angeles, CA
Country: United States (us)
Thank you!!!

_________________
Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work


Top
 Profile E-mail WWW  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: