Reading external file in Attain

ckck Member Posts: 6
edited 2008-04-10 in Navision Attain
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;
:cry:

Comments

  • DenSterDenSter Member Posts: 8,307
    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.
  • ckck Member Posts: 6
    :cry: Thanks a lot. But I don't get it to work.
Sign In or Register to comment.