0

I'm new to business central, I want to remove an attached image file because my client requested that functionality. I created a function that will check that, and it is all working fine. I noticed that I'm doing a repetition for all the image fields, which got me writing the function for every blob field on the page.

I want to write a single function then pass a blob params then receive that and do the check. But I noticed that I can't declare a blob file as a params.

 procedure CheckImageFieldValue(imagefile: Blob; removeImageFile: Boolean)
    begin
        removeImageFile := false;
        if imagefile.HasValue() then begin
            removeImageFile:= true;
        end
        else begin
             removeImageFile := false;
        end;
    end;

Error: 'Blob' is not a valid variable type

AbdulAzeez Olanrewaju
  • 976
  • 1
  • 13
  • 32

1 Answers1

0

The Blob data type is a bit tricky to work with.

If you wanted to do something like this, you would have to stream the blob to a TempBlob (it's an object either Record or Codeunit depending on which version of Business Central you are running).

But streaming the blob to a TempBlob requires you to load the content, which would include at check to see if the Blob has a value.

kaspermoerch
  • 16,127
  • 4
  • 44
  • 67