Files in Folder - read at regular intervals.

rchikka
Member Posts: 23
Hi All,
We are doing some integration work w.r.t xml data exchange.
An external system places files in folder ( for ex : the path is
\import )
I m reading a folder , which has xml files, at 10 min interval using this code.
recdir.RESET;
recdir.SETRANGE(Path,gettextpath()); // ( gettextpath function gets the path as
\Import )
recdir.SETRANGE("Is a file",TRUE);
IF recdir.FIND('-') THEN
REPEAT
CU1.ImportFile(Txtpath + '\' + recdir.Name);
CU1.CopyFiles(SSetup.CustomerImportPath,SSetup.CompletedCustomerPath,recdir.Name);
UNTIL recdir.NEXT =0
I will be calling a codeunit ( CU1) which calls the xml port.
Now first time the folder does have 2 xml ( say xmlfile1 and xmlfile 2 ) files and i have read them successfully and imported into the database and deleted these 2 files.
now my above code gets executed once again but this time, its not refreshing , its not identifying new files in the folder but always refers to the same old file which has been read and deleted.
so my code stops here.
Kindly suggest how to proceed on this.
Regards,
chikka.
We are doing some integration work w.r.t xml data exchange.
An external system places files in folder ( for ex : the path is

I m reading a folder , which has xml files, at 10 min interval using this code.
recdir.RESET;
recdir.SETRANGE(Path,gettextpath()); // ( gettextpath function gets the path as

recdir.SETRANGE("Is a file",TRUE);
IF recdir.FIND('-') THEN
REPEAT
CU1.ImportFile(Txtpath + '\' + recdir.Name);
CU1.CopyFiles(SSetup.CustomerImportPath,SSetup.CompletedCustomerPath,recdir.Name);
UNTIL recdir.NEXT =0
I will be calling a codeunit ( CU1) which calls the xml port.
Now first time the folder does have 2 xml ( say xmlfile1 and xmlfile 2 ) files and i have read them successfully and imported into the database and deleted these 2 files.
now my above code gets executed once again but this time, its not refreshing , its not identifying new files in the folder but always refers to the same old file which has been read and deleted.
so my code stops here.
Kindly suggest how to proceed on this.
Regards,
chikka.
0
Comments
-
You need to change the Path to refresh the virtual table. See http://lmsmfy.com/?q=file+path+refreshNo support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
Thanks Luc.
Regards,
Chikka.0 -
Luc Van Dyck wrote:You need to change the Path to refresh the virtual table. See http://lmsmfy.com/?q=file+path+refresh
Wow.. that's obscure. I'll give it a try - thanks for the help !0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions