Is there a way to do a file search with a standard Navision data type?
I looked at the functions and methods in the Navision 'File' data type and couldn't see a way to do this.
What I need to accomplish is this:
When the user runs a dataport and types in the filename to import/export to, instead of typing in c:\temp\data.txt, they would type in c:\temp\*.txt.
At this point the dataport needs to do a search in the c:\temp directory and find the first file with a .txt extension and continue processing using that file.
Is there an easy way to do this?
0
Comments
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Now, when there are an unlimited amount of directories, you should have a recursive function, and I don't really know C/SIDE can do such things (never tried).
I hope this answer is sufficient...
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
But as a sample: i have different files inside a directory, like *.txt, *.rtf, etc. If i want to filter out only *.txt, how can i do this?
recFile.SETRANGE(Name, '*.txt') shows no result.
If i use it w/o 'SETRANGE(Name....)', i get ALL files.
Any idea for this?
.
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
recFile.SETFILTER(Name, 'abc*');
cannot find the file with file name ABCD.txt but can get file with file name abcd.txt.
How to make the SETFILTER case-insensitive ?
Thanks,
Hawwa
SETFILTER(FIELD, '*@value*');
The @ makes it case-insensitive
recFile.SETRANGE(Path, 'C\PO\');
recFile.SETRANGE("Is a file", TRUE);
recFile.SETFILTER(Name, '@po*');
Thanks.
What you can try is to make a new form on the file table and set your filter.
Then you can try visualy if the filter is correct.
The file table is somewhat odd; it is only filled after setting a filter.
Maybe you should make code like:
file.setrange("is a file" true);
if find.find('-') then repeat
fileexists := strpos('PO', UPPERCASE(File.name)) <> 0;
until file.next = 0;
Suc6.
Marq
I have tried the File table with a List Form. No matter what combination of filter I used, it is still case-sensitiv for the Name field.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
recFile.SETRANGE(Path, 'C\PO\');
recFile.SETRANGE("Is a file", TRUE);
recFile.SETFILTER(Name, '@po*');
The messages I got are "setup.ini", "Setup.exe", "SETUP.LST".
That doesn't work for me. What version of Navision are you using ? I am using Navision Version 4.0 running on SQL Server 2000.
Tested is now on MBS-Navision W1 4.0, local Navision database: works also.
I just wanted to have a look at this table but the table is empty. :-s
I created a new Tabular-Type Form using the 'File'-Table and saved the form without any filters.
Working with Navision 3.7
:-k
oops, Mark wrote it already. :oops: After setting a constant filter on 'Path' the form shows the records.
thanks
Try this, it works for me in V3.70
recFile.SETRANGE(Path, 'C\PO\');
recFile.SETRANGE("Is a file", TRUE);
recFile.SETFILTER(Name, '%1', '@po*.*');