why my coding some times can't locate the records?

rxqrxqrxq_zyd
Member Posts: 19
hello I meet a issue based on the Virtual Table: file in Navision 2009,can I discuss with you? I am doing the code like:
(the ImportFile is the record based on File Record)
ImportFile.RESET;
ImportFile.SETRANGE(Date,WORKDATE);
ImportFile.SETRANGE(Path,ImportPath);
ImportFile.SETRANGE("Is a file",TRUE);
ImportFile.SETFILTER(Name,'%1','con_*.csv'); //Jerry Edited
//Jerry add this coding to pick the Sales/transfer Order from many input files,
//and then prepare for the function ImportData pick the correct data
IF ImportFile.FIND('-') THEN
REPEAT
FileName := ImportPath + ImportFile.Name; //Jerry
ImportData();
IF FILE.EXISTS(FileName) THEN
IF FILE.COPY(FileName,BackupPath + ImportFile.Name) THEN
Archived := TRUE;
IF Archived THEN
FILE.ERASE(FileName);
CLEAR(FileName);
CLEAR(Archived);
UNTIL ImportFile.NEXT =0;
but some time, some files can't be caught by these coding,I don't know why! Can you please share of some of your experience based on that? thanks !
(the ImportFile is the record based on File Record)
ImportFile.RESET;
ImportFile.SETRANGE(Date,WORKDATE);
ImportFile.SETRANGE(Path,ImportPath);
ImportFile.SETRANGE("Is a file",TRUE);
ImportFile.SETFILTER(Name,'%1','con_*.csv'); //Jerry Edited
//Jerry add this coding to pick the Sales/transfer Order from many input files,
//and then prepare for the function ImportData pick the correct data
IF ImportFile.FIND('-') THEN
REPEAT
FileName := ImportPath + ImportFile.Name; //Jerry
ImportData();
IF FILE.EXISTS(FileName) THEN
IF FILE.COPY(FileName,BackupPath + ImportFile.Name) THEN
Archived := TRUE;
IF Archived THEN
FILE.ERASE(FileName);
CLEAR(FileName);
CLEAR(Archived);
UNTIL ImportFile.NEXT =0;
but some time, some files can't be caught by these coding,I don't know why! Can you please share of some of your experience based on that? thanks !
0
Answers
-
Good morning, I think there's some "bug" in nav versions, I recommend you do this first to "initialise":
//"initialise" CLEAR(FileRec); FileRec.SETCURRENTKEY(Path,"Is a file",Name); FileRec.SETRANGE(Path,'C:\temp\'); IF FileRec.FINDFIRST THEN ;
for me %1 didnt work, I sorted like:FileRec.SETRANGE(Path,'yourpath'); FileRec.SETRANGE("Is a file",TRUE); FileRec.SETFILTER(Name,'order_response*'); //'%1*' doesnt work IF FileRec.FINDSET THEN REPEAT //do your thing UNTIL FileRec.NEXT=0;
0 -
Did you tried the way txeriff suggested?Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
Hi,
In my experience, the File virtual table sometimes does not work on mapped / network drives.
I resorted to using the Dotnet.
e.g.
https://forum.mibuso.com/discussion/61335/read-client-files-in-folder0 -
thanks everybody finanlly I found I should not add the coding, ImportFile.SETRANGE(Date,WORKDATE); when I comment this sentence, it was working, it is closed, thanks0
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