Options

dot net array to text

DreckigerDanDreckigerDan Member Posts: 3
edited 2015-09-30 in NAV Three Tier
I have the following problem:

There is an image stored in a BLOB field and i want the binary or hexadecimal value of it.
I tried the following approach but there are several problems/questions:
  • How do you cast the values of the array to text?
  • How do you convert the text to hex or binary?
  • Is there a more efficient solution?
Record.CALCFIELDS(Picture);
IF Record.Picture.HASVALUE THEN BEGIN

  Record.Picture.CREATEINSTREAM(InStream);
  DotNetMemoryStream := DotNetMemoryStream.MemoryStream();
  COPYSTREAM(DotNetMemoryStream, InStream);
  
  DotNetArray := DotNetMemoryStream.ToArray();

  FOR i := 0 TO DotNetArray.Length -1 DO BEGIN
    //??
  END;

END;

Regards,
DreckigerDan

Comments

  • Options
    EvREvR Member Posts: 178
    I assume you want the data to export it to another system?
    If so, I would suggest just converting the blob to base64 instead.
    More efficient, no need to create loops. Just one line of code.
  • Options
    DreckigerDanDreckigerDan Member Posts: 3
    I need the binary/hex data to use it in an RTF document I create in Nav. I tried Base64 and used the string for my document.
    {\pict\pngblip\picw250\pich250\picwgoal250\pichgoal250 Base64String}
    
    The picture isn't displayed.

    Thank you for your help.
    DreckigerDan
Sign In or Register to comment.