How to determine the size used in a BLOB field?

kadeekadee Member Posts: 7
edited 2004-07-09 in Navision Attain
Does anyone know how to determine the size used in a BLOB field, in a native Navision environment?
I have been searching the Help, documentation and virtual tables, but without result :(

Comments

  • AfonsoAfonso Member Posts: 27
    Hello,

    I think this is a limited size field, you can input files until a certain size, i don't remember the exact size, but you cannot change the size used in the BLOB.

    Regards

    Afonso
  • kinekine Member Posts: 12,562
    WHat about this workaround:

    export blob into file and get size of this file... :-)

    I didn't found standard function for this...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • fbfb Member Posts: 246
    Here's an idea:
    VAR
      CompanyInfo : Record 79;
      InStreamObj : InStream;
      intLen : Integer;
      intBytesRead : Integer;
      binVariable : Binary[250];
    
    BEGIN
      intLen := 0;
      CompanyInfo.GET;
      CompanyInfo.CALCFIELDS(Picture);
      CompanyInfo.Picture.CREATEINSTREAM(InStreamObj);
      REPEAT
        intBytesRead := InStreamObj.READ(binVariable);
        intLen += intBytesRead;
      UNTIL intBytesRead = 0;
      MESSAGE('Company Info Picture length is %1.',FORMAT(intLen));
    END
    
  • kadeekadee Member Posts: 7
    I guess determination based on an export via OutStream would be the more appealing way to choose here; too bad it can't be used for intensive operations with big files.
    Anyway, thanks for the replies, folks.
  • fbfb Member Posts: 246
    I'm not sure why you say 'export' and 'OutStream'. My recommendation does not require a BLOB.Export to a file, nor does it use an OutStream object.

    The 'InStream' I suggested is used as a way to 'stream the contents of the BLOB field into a local variable', counting the bytes along the way. No external file is created.

    It seems that this method should work acceptably, even with large BLOB's, no?
Sign In or Register to comment.