Reading external file in Attain

ck
Member Posts: 6
I have this code in a CU to inform wheter there is a file you miss to import.
Doing right first time, but even the file is removed it tells you it is there.
If you after the client is started put a file in the library it does not tell.
Works only if you every time leave Attain and then open again (Esc+F12)
Can you avoid this ?
Code:
Bocom.GET;
ok:=EXISTS(Bocom."VBS2008 sti"+Bocom.Firmanummer+'\tjeck.txt');
IF ok THEN BEGIN
CLEAR(files);
files.RESET();
files.SETRANGE(files.Path, Bocom."VBS2008 sti"+Bocom.Firmanummer);
files.SETRANGE(files."Is a file", TRUE);
files.SETFILTER(files.Name,'*.kmp');
IF files.FIND('-') THEN REPEAT
filnavn:= files.Name;
Date :=files.Date;
filnavn := DELCHR(filnavn,'=','kamp');
filnavn := DELCHR(filnavn,'=','.kmp');
MESSAGE ('Kampagne nr. %1 er ikke indlæst - lavet %2',filnavn,Date);
UNTIL files.NEXT = 0;
END;
Doing right first time, but even the file is removed it tells you it is there.
If you after the client is started put a file in the library it does not tell.
Works only if you every time leave Attain and then open again (Esc+F12)
Can you avoid this ?
Code:
Bocom.GET;
ok:=EXISTS(Bocom."VBS2008 sti"+Bocom.Firmanummer+'\tjeck.txt');
IF ok THEN BEGIN
CLEAR(files);
files.RESET();
files.SETRANGE(files.Path, Bocom."VBS2008 sti"+Bocom.Firmanummer);
files.SETRANGE(files."Is a file", TRUE);
files.SETFILTER(files.Name,'*.kmp');
IF files.FIND('-') THEN REPEAT
filnavn:= files.Name;
Date :=files.Date;
filnavn := DELCHR(filnavn,'=','kamp');
filnavn := DELCHR(filnavn,'=','.kmp');
MESSAGE ('Kampagne nr. %1 er ikke indlæst - lavet %2',filnavn,Date);
UNTIL files.NEXT = 0;
END;

0
Comments
-
Yes that is a very nasty bug in the File virtual table, but easy to get around once you know about it
. It keeps a snapshot of the files when you do FIND, and for some reason it does not read it again, even when you force another read. One way to refresh is to change one of the filters, do another FIND, then restore the filter back to what you need and do another FIND. Another way would be to CLEAR the variable and rebuild it.
0 -
Thanks a lot. But I don't get it to work.
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