File Directory Listing

marina_eemarina_ee Member Posts: 30
I need to import files with dynamic filename, for example this naming convention: POrder[YYMMDD].txt, where the [YYMMDD] is dynamically named by a third party software according to their generation date.

I have setup the dataport according to the file structure, my intention is to have a codeunit to find the list of filenames, then call dataport with file name parameter to process them one by one. Is this possible?

Please help.

Comments

  • ara3nara3n Member Posts: 9,257
  • marina_eemarina_ee Member Posts: 30
    CLEAR(recFile);
    recFile.SETRANGE(Path, FeedPath);
    recFile.SETRANGE("Is a file", TRUE);
    recFile.SETFILTER(Name, '@s*');

    recFile is a variable of
    DataType-Record
    SubType-File 2000000022

    but when I access symbol menu, there are no fields named path, "Is a file", "Name"?
  • ara3nara3n Member Posts: 9,257
    does your code compile?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • marina_eemarina_ee Member Posts: 30
    no, it says:

    You have specified an unknown variable.

    Path

    Define the variable under "Global C/AL symbols'.
  • kinekine Member Posts: 12,562
    And which fields you can see in the symbol menu? Sometimes the fields are localized...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • marina_eemarina_ee Member Posts: 30
    Code
    Description
    Type
    File Name
    Table ID
    Table Name
    Export Filter Key
    Export Filter Field 1
    Export Filter Field Name 1
    Export Filter Text 1
    Export Filter Field 2
    Export Filter Field Name 2
    Export Filter Text 2
    File Filter Key
    File Filter Field 1
    File Filter Field name 1
    File Filter Text 1
    File Filter Field 2
    File Filter Field name 2
    File Filter Text 2
    File Columns
  • kinekine Member Posts: 12,562
    I mean fields for the recFile variable... :-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • marina_eemarina_ee Member Posts: 30
    yeah, this are the fields i saw when i click symbol menu. It is weird isnt it? I check my declaration many times, it is correct.

    Name - recFile
    DataType - Record
    Subtype - File

    SQL Server 2000
    Navision 4.0 SP2
  • marina_eemarina_ee Member Posts: 30
    i tried it with another database from another client in the same server, it works. Path, Is a File, etc... do appear in symbol menu.
  • kinekine Member Posts: 12,562
    It seems like there are two tables with name File. Try to enter the subtype through ID not through name...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • marina_eemarina_ee Member Posts: 30
    great, solved, now i can proceed, many thanks.
    never thought of this because i choose from the table list.
  • ara3nara3n Member Posts: 9,257
    Looks like you can have the same table name for File and Navision doesn't complain about it being reserved?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kinekine Member Posts: 12,562
    No, because it seem like Navision is testing just regular tables and not Virtual table names. Try it, it is allowed to create table with name File or e.g. Breakpoint etc.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.