I am creating a Report for Business Central, a Purchase Order Report. The Purchase Order page is extended to add Work Description which is a blob data type. I have added the blob field to my Report Extension and now I went to convert the Blob to Text like it is seen in my page. Example: "This is a Test Work Description". I believe I have to use InStream and then Read. Can someone provide example code to assist me in adding this to my report as text?
You can find good examples here on the Microsoft documentation: Write, WriteText, Read, and ReadText Method Behavior for Line Endings and Zero Terminators
But I think this is what you need:
procedure GetWorkDescription (PurchHeader: Record "Purchase Header")WorkDescription: Text
var
MyInStream: InStream;
begin
Clear(WorkDescription);
PurchHeader.Calcfields("Work Description");
If PurchHeader."Work Description".HasValue() then begin
PurchHeader."Work Description".CreateInStream(MyInStream);
MyInStream.Read(WorkDescription);
end;
end;