hello,
to convert the base64 code and store it in a table blob field, you can do it this way:
var
RecRef : RecordRef;
cuTempBlob: Codeunit "Temp Blob";
DocOutStrem: OutStream;
Base64Convert: Codeunit "Base64 Convert";
begin
cuTempBlob.CreateOutStream(DocOutStrem);
Base64Convert.FromBase64(base64value, DocOutStrem);
RecRef.GetTable(Rec);
cuTempBlob.ToRecordRef(RecRef ,Rec.FieldNo(BlobField));
RecRef.SetTable(Rec);
end;
to read the xml file contained in the blob inside the AL code, you can use XMLDOCUMENT like this
var
XmlDoc: XmlDocument;
inStr : Instream;
begin
Rec.CALCFIELDS(BlobField);
Rec.BlobField.CreateInStream(inStr);
XmlDocument.ReadFrom(inStr, XmlDoc);
end;
from here you can use the methods (XmlDoc.SelectNodes, XmlDoc.SelecSingleNode,...etc)
look at the documentation to learn more:
learn.microsoft.com/.../xmldocument-data-type
if you want to save and download the content in xml files on your machine:
var
XmlDoc : XmlDocument;
inStr : Instream;
FileName : Test;
begin
FileName := 'myXmlFile.xml';
Rec.CALCFIELDS(BlobField);
Rec.BlobField.CreateInStream(inStr);
DownloadFromStream(inStr, '', '', FileName);
end;
if it helped you, please select this answer, thank you