Hello Friends
Below we use to import Base64 String data to Blob Field in record.
codeunit 50100 "Import Base 64"
{
Permissions = tabledata 112 = RM;
procedure UpdateInvoiceQRCode(InvoiceNo_iCod: Code[20]; DataBASE64_iTxt: Text)
var
Base64CU: Codeunit "Base64 Convert";
VarOutStream: OutStream;
SIH_lRec: Record "Sales Invoice Header";
begin
InvoiceNo_iCod := UpperCase(InvoiceNo_iCod);
IF InvoiceNo_iCod = '' then
Error('Enter Invoice No.');
IF DataBASE64_iTxt = '' then
Error('Enter Correct Base 64');
SIH_lRec.GET(InvoiceNo_iCod);
SIH_lRec.CalcFields("QR Code");
SIH_lRec."QR Code".CreateOutStream(VarOutStream);
Base64CU.FromBase64(DataBASE64_iTxt, VarOutStream);
SIH_lRec.Modify();
end;
}
Below code to used copy Media Image from One Record to Another Record in different company
var
TenetMedia: Record "Tenant Media";
TenantMediaSet: Record "Tenant Media Set";
Media_InStream: InStream;
begin
If "VTK BOM Picture".Count <> 0 then begin
VTKProdBOMVersion.Reset();
VTKProdBOMVersion.ChangeCompany(SelectCompanyName);
VTKProdBOMVersion.SetRange("Production BOM No.",
"VTK Production BOM Version"."Production BOM No.");
VTKProdBOMVersion.SetRange("Version Code",
"VTK Production BOM Version"."Version Code");
IF VTKProdBOMVersion.FindFirst() THEN
for index := 1 to
"VTK Production BOM Version"."VTK BOM Picture".COUNT do begin
TenetMedia.GEt
("VTK Production BOM Version"."VTK BOM Picture".ITEM(index));
TenetMedia.CalcFields(Content);
IF TenetMedia.Content.HasValue Then begin
TenetMedia.Content.CreateInStream
(Media_InStream, TextEncoding::Windows);
VTKProdBOMVersion."VTK BOM Picture".ImportStream
(Media_InStream, TenetMedia.Description, TenetMedia."Mime Type");
VTKProdBOMVersion.Modify(true);
end;
End;
end;
No comments:
Post a Comment