Options

Reading BLOB format from Navision

aquawateraquawater Member Posts: 71
Anybody knows what format of image that was stored in Navision Database ?

I tried to read BLOB data from table ITEM, column PICTURE.
And I saved it as BITMAP. I am not able to open this file.
It seems the BLOB data is not BITMAP at all. What kind of encoding does NAV do ?

I am trying to upload BMP format to NAV database (SQL Server Option) as we do not have developer license to modify any object. I am wondering if I could do it from C# [ convert any JPEG to BMP, and upload it to SQL ]...

Please advice, guys.
Thank you.

Comments

  • Options
    garakgarak Member Posts: 3,263
    The Files that you are stored into a BLOB field will be compressed (property in the field Picture on Item Table).
    NAV and his own "picture viewer" can only display BMP (search for this also the forum) files.
    So, if you need do "extract" the value of the BLOB with, for example a 3-rd Application like a C# programm you must deactivate the compression (need dev.license).

    If you think it is a correct bmp and it will not displayed in a report or the picture box, try this:
    Extract the BLAB value to a directory. Open the picture in a picture viewer or picture program. Then do a Print Screen (Ctrl+Print).
    Paste the print screen into a picture programm like the MS Paint and cut only the needed picture.
    Store this picture as a new bmp file on your drive and lead it into you BLOB field (for example in the field Picture on Item Table.)

    regards
    Do you make it right, it works too!
  • Options
    aquawateraquawater Member Posts: 71
    Thanks, garak for the input.
    I just noticed that COMPRESSED property in table designer after google-ing for hours.

    I managed to extract the BLOB value to bitmap if the COMPRESSED is turned off. [we have license to alter table, form designer, but not C/AL CODE]

    It seems there is no way to extract a COMPRESSED BLOB ??
  • Options
    mandykmandyk Member Posts: 57
    Hi aquawater,

    If you want to export out the BMP picture out from Navision Item blob field is just very easy.
    If you can open form 346 Item Picture there is small code to export the picture out.
    Here is the codes from the form:

    IF Picture.HASVALUE THEN
    Picture.EXPORT('*.BMP',TRUE);

    When you run this code, you will see Common Dialog window to determine the location and the filename. The simple test once you have got the picture file is by any browser and drag in your picture file in browser space. The browser should display the picture.


    Below is to Import the picture:

    PictureExists := Picture.HASVALUE;
    IF Picture.IMPORT('*.BMP',TRUE) = '' THEN
    EXIT;
    IF PictureExists THEN
    IF NOT CONFIRM(Text001,FALSE,TABLECAPTION,"No.") THEN
    EXIT;
    CurrForm.SAVERECORD;

    When you run above code, it will show dialog box to select the BMP file.
    Thus, regardless of what data that you want to import or export, you could just store the content of the file as in original format.

    As addition info:

    The Picture blob field in Item table is meant to store BMP format picture and it is limited to the Navision Picture Box control capability. However Just FYI, for commerce portal, Navision has extend another table call pictures table. the blob content data inside this table was not binary data of JPEG, it is XML form that containt data picture in text format. I tried to converting back the string data into binary data using string base 64 format, unfortunately unsucessful. The picture text has encrypted and only component provided by Navision CommercePortal can view and import perfectly.

    So, just consider the picture format that you want to import into Navision, because standard Nav could only display BMP, for other format need to create component. I think one of our friend in Mibuso has post article on how to display GIF/JPEG picture in Navision.

    You could using C# to inject the binary data of the picture into Navision SQL table, but that is not effective way. The other ways you could consider is to use the Navision C/Front or N/ODBC. But not very sure if your license need granule to allow you using C/Front or N/ODBC.




    Regards
  • Options
    aquawateraquawater Member Posts: 71
    Thanks for the explanation, mandy.

    I think there is no answer to my question, "what compression type used by NAV to store BLOB image".
    I have searched through and it seems a lot users are asking the same thing.

    Sorry for the trouble.
  • Options
    garakgarak Member Posts: 3,263
    A little tip: If you work with many pictures (or Files that u store into the BLOB), like on Item, don't store the Pictures in the BLOB field on the Item Table.
    Use a separate "Item Picture" table or store the Pictures on HDD and save only the Path (viewtopic.php?t=12861).

    Why?
    Follow this LINK, it's a good example.
    And it's better illustrated as i can wrote here ;-)

    Regards
    Do you make it right, it works too!
  • Options
    aquawateraquawater Member Posts: 71
    Thanks a lot for the input, Garak. Especially the LINK.
    We will definitely face a performance issue, if NAV always use "SELECT * FROM ITEM" ....
    That's crazy... #-o
  • Options
    garakgarak Member Posts: 3,263
    Yes ....
    Do you make it right, it works too!
Sign In or Register to comment.