EXISTS syntaxe

I try to read some file in a directory whitch always begin with CWI*.*. I want to know if it exist a syntax or a method to read this files directly with a codeunit. I need to integrate this file in the table 36 and 37. Thanks for all your answer Stéphane VABOIS

  recFile : Record File;

  SETRANGE("Is a file",TRUE);
  SETFILTER(Name, 'CWI*');
  IF FIND('-') THEN;</b>
  IF FIND('-') THEN repeat
    currentfilename := UPPERCASE(Name);

  until recFile.NEXT = 0;

recFile.FIND does read the directory with the filters provided (Path, Name, IsFile). The statements … SETRANGE(Path,’’); IF FIND(’-’) THEN; SETRANGE(Path,‘C:\MyImport\Directory’); IF FIND(’-’) THEN repeat … might look strange on first glance as it doesn’t make sense to do a FIND(’-’) twice with different filters. In this case however it is necessary as we force Navision to change directories and therefore force a re-read and new initialization of the temporary recFile-Table. One problem might occur: The above code will only read files starting with CWI. It will not find files, starting with Cwi or cwi. So if you are not absolutely sure that the filenames always are in uppercase you better delete the SETFILTER(NAME), read all files, convert their names to uppercase and do a manual check for the filename. With best regards from Switzerland Marcus Fabian

well… it’s just a 3 characters combination on the setfilter if you prefer to use Marcus system without almost modification… if it was with more characters…the uppercase routine would be probably best… but for just 3 characters you can use like this: SETFILTER(Name,‘CWI*|CWi*|CwI*|cWI*|Cwi*|cWi*|cwI*|cwi*’); Regards Alfonso Pertierra (Spain)apertierra@teleline.es