In a customers environment NAV2015 CU4 when searching for the file-contents of a directory, nothing is found.
Using GET or filter on a existing complete filename files can be found. How come wildcards in filter can't return a list of files?? Needs Clues in order to fix this so please any and all ideas are welcome.
Example code:
Local VAR:
Name DataType Subtype Length
MicrobizzSetup Record Microbizz Setup
FileRec Record File
MicrobizzSetup.GET;
CLEAR(FileRec);
FileRec.RESET;
FileRec.INIT;
FileRec.SETRANGE(Path,MicrobizzSetup."Inbound Processed File Path");
IF FileRec.FINDFIRST THEN;
FileRec.SETRANGE(Path,MicrobizzSetup."Inbound File Path");
IF FileRec.FINDFIRST THEN
MESSAGE('1. - OK\'+FileRec.Path +'\'+FileRec.Name)
ELSE
MESSAGE('ERROR - FILE NOT FOUND #1\'+FileRec.GETFILTERS); //THIS IS RETURNED
CLEAR(FileRec);
FileRec.RESET;
FileRec.INIT;
FileRec.SETRANGE(Path,MicrobizzSetup."Inbound Processed File Path");
IF FileRec.FINDFIRST THEN;
FileRec.SETRANGE(Path,MicrobizzSetup."Inbound File Path");
FileRec.SETRANGE("Is a file",TRUE);
IF FileRec.FINDFIRST THEN
MESSAGE('2. - OK\'+FileRec.Path +'\'+FileRec.Name)
ELSE
MESSAGE('ERROR - FILE NOT FOUND #2\'+FileRec.GETFILTERS); //THIS IS RETURNED
CLEAR(FileRec);
FileRec.RESET;
FileRec.INIT;
FileRec.SETRANGE(Path,MicrobizzSetup."Inbound Processed File Path");
IF FileRec.FINDFIRST THEN;
FileRec.SETRANGE(Path,MicrobizzSetup."Inbound File Path");
FileRec.SETRANGE("Is a file",TRUE);
FileRec.SETFILTER(Name,'*.xml');
IF FileRec.FINDFIRST THEN
MESSAGE('3. - OK\'+FileRec.Path +'\'+FileRec.Name)
ELSE
MESSAGE('ERROR - FILE NOT FOUND #3\'+FileRec.GETFILTERS); //THIS IS RETURNED
CLEAR(FileRec);
FileRec.RESET;
FileRec.INIT;
FileRec.SETRANGE(Path,MicrobizzSetup."Inbound Processed File Path");
IF FileRec.FINDFIRST THEN;
FileRec.SETRANGE(Path,MicrobizzSetup."Inbound File Path");
FileRec.SETRANGE("Is a file",TRUE);
FileRec.SETFILTER(Name,'2016-02-02T15-51-03_requisitions.xml');
IF FileRec.FINDFIRST THEN
MESSAGE('4. - OK\'+FileRec.Path +'\'+FileRec.Name) //THIS IS RETURNED
ELSE
MESSAGE('ERROR - FILE NOT FOUND #4\'+FileRec.GETFILTERS);
CLEAR(FileRec);
FileRec.RESET;
FileRec.INIT;
IF FileRec.GET(MicrobizzSetup."Inbound File Path",TRUE,'2016-02-05T08-40-03_requisitions.xml') THEN
MESSAGE('5. - OK\'+FileRec.Path +'\'+FileRec.Name) //THIS IS RETURNED
ELSE
MESSAGE('ERROR - FILE NOT FOUND #5\'+FileRec.GETFILTERS);
*This post is locked for comments
I have the same question (0)