How to find the size of the File in Navision

gmaadhangmaadhan Member Posts: 2
Hi All,

is it possible to find the size of the file in Navision?

Senario:

I did a customization for attaching documents. So at the time of selecting a particular file, I just want to know the size of the file to restrict.

any idea....

Thanks
G. Madhan

Comments

  • ta5ta5 Member Posts: 1,164
    Have a look at the virtual table called "file". Its behaviour is like a common table, but it is virtual and represents the file system.

    Hope this helps
    Thomas
  • DaveTDaveT Member Posts: 1,039
    Hi G. Madhan,

    If I understand you correctly - are you asking what the maximum file size that can be store in Nav. If so and assuming you are storing as a blob.

    From the help:
    BLOB
    A BLOB (Binary Large Object) is a complex data type. Variables of this data type differ from normal numeric and string variables in that BLOBs have a variable length.

    The maximum size of a BLOB is normally determined by your system's disk storage capacity. However, the maximum size in C/SIDE is 2GB.

    Another solution is to store a link to the document in the record link table and hyperlink to it to view.

    Hope this helps.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    Hi, gmaadhan

    Did you find the solution for the file size?
    Here I have also the same problem. I want to store the Imported file
    size in the table field. So Please help me regarding this issue if you can.
    Thanks in Adv.
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
  • MBergerMBerger Member Posts: 413
    Getting the size of a file isn't too difficult :
        PROCEDURE GetFileSize@1000000000(FileName@1000000000 : Text[1024]) FileSize : Integer;
        VAR
          InFile@1000000001 : File;
        BEGIN
          InFile.OPEN(FileName) ;
          FileSize := InFile.LEN ;
          InFile.CLOSE ;
        END;
    
  • BeckaBecka Member Posts: 178
    LEN (File)
    Use this function to return the length of an ASCII or binary file.

    Length := File.LEN
    Length

    Data type: integer

    This tells you the length of the file in bytes.

    File

    Data type: file

    Use this variable to refer to the file.

    Good Luck :)
    MCSD
    Attain Navision
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    Thank You very much to you all.

    Actually I wanted to make my code More efficient. So I did this post.

    The code which I had written was...

    FileG.RESET;
    FileG.SETRANGE(Path,FlPath);
    FileG.SETRANGE("Is a file",TRUE);
    FileG.SETFILTER(Name,'%1','*.*');
    IF FileG.FINDFIRST THEN BEGIN
    REPEAT
    IF FileG.Name = FlName THEN
    "File Size" := FileG.Size;
    UNTIL FileG.NEXT = 0;
    END;

    Using it I was able to satisfy my requirement..
    But the code which you wrote works very well and also very efficient...

    Thanks a Lot. :D:lol::o
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
  • william_marcelinuswilliam_marcelinus Member Posts: 34
    Thanks for this post, =D>

    also added, when using File variable always CLOSE it in the end of process.. :wink:
Sign In or Register to comment.