How to convert blob field to base64 format in BC 16

Hi guys,

May I know how to convert blob field to base64 format in BC 16?

Thank you.

Answers

  • PhoguePhogue Member Posts: 76
    edited 2020-09-01
    procedure Encode(YourRecord: Record "YourRecord")
    var
      Base64Convert: Codeunit "Base64 Convert";
      TempBlob: Codeunit "Temp Blob";
      InStream: InStream;
      Base64Result: Text;
    begin
       YourRecord.CalcFields(YourBlobField);
       TempBlob.FromRecord(YourRecord, YourRecord.FieldNo(YourBlobField));
       TempBlob.CreateInStream(InStream);
       Base64Result := Base64Convert.ToBase64(InStream);
    end
    

    This should convert your blob field to base 64.
Sign In or Register to comment.