I want to import Blob fields into my custom "Service Worksheet Table".all data imported but Blob Field Data not Inserted into table.
please give me suggestion How to achieve this.
blob fields.
1.Fault Comment Line
2.Resolution Comment Line
3.Internal Comment Line
local procedure ImportExcelData()
var
SOImportBuffer: Record "ST_Service Worksheet LineTable";
RowNo: Integer;
ColNo: Integer;
LineNo: Integer;
MaxRowNo: Integer;
begin
RowNo := 0;
ColNo := 0;
MaxRowNo := 0;
LineNo := 0;
SOImportBuffer.Reset();
if SOImportBuffer.FindLast() then
LineNo := SOImportBuffer."Line No.";
TempExcelBuffer.Reset();
if TempExcelBuffer.FindLast() then begin
MaxRowNo := TempExcelBuffer."Row No.";
end;
for RowNo := 2 to MaxRowNo do begin
LineNo := LineNo 10000;
SOImportBuffer.Init();
SOImportBuffer."Line No." := LineNo;
Evaluate(SOImportBuffer."Serial No.", GetValueAtCell(RowNo, 1));
Evaluate(SOImportBuffer."Service Item No.", GetValueAtCell(RowNo, 2));
Evaluate(SOImportBuffer."Customer No.", GetValueAtCell(RowNo, 3));
Evaluate(SOImportBuffer."Customer Name", GetValueAtCell(RowNo, 4));
Evaluate(SOImportBuffer."Ship-to Code", GetValueAtCell(RowNo, 5));
Evaluate(SOImportBuffer."Shipment No.", GetValueAtCell(RowNo, 6));
Evaluate(SOImportBuffer."Shipment Date", GetValueAtCell(RowNo, 7));
Evaluate(SOImportBuffer."Item No.", GetValueAtCell(RowNo, 8));
Evaluate(SOImportBuffer.Description, GetValueAtCell(RowNo, 9));
Evaluate(SOImportBuffer."Description 2", GetValueAtCell(RowNo, 10));
Evaluate(SOImportBuffer."Fault Area Code", GetValueAtCell(RowNo, 11));
Evaluate(SOImportBuffer."Symptom Code", GetValueAtCell(RowNo, 12));
Evaluate(SOImportBuffer."Fault Code", GetValueAtCell(RowNo, 13));
Evaluate(SOImportBuffer."Resolution Code", GetValueAtCell(RowNo, 14));
Evaluate(SOImportBuffer."No. of Previous Services", GetValueAtCell(RowNo, 15));
Evaluate(SOImportBuffer."Service Order No.", GetValueAtCell(RowNo, 16));
Evaluate(SOImportBuffer."Fault Comment Line", GetValueAtCellBlob(RowNo, 17));
Evaluate(SOImportBuffer."Resolution Comment Line", GetValueAtCellBlob(RowNo, 18));
Evaluate(SOImportBuffer."Internal Comment Line", GetValueAtCellBlob(RowNo, 19));
SOImportBuffer."Sheet Name" := SheetName;
SOImportBuffer."File Name" := FileName;
SOImportBuffer.Insert();
end;
Message(ExcelImportSucess);
end;
local procedure GetValueAtCell(RowNo: Integer; ColNo: Integer): Text
begin
TempExcelBuffer.Reset();
If TempExcelBuffer.Get(RowNo, ColNo) then
exit(TempExcelBuffer."Cell Value as Text")
else
exit('');
end;
local procedure GetValueAtCellBlob(RowNo: Integer; ColNo: Integer): Text
var
CellTextValue: text;
RecInStream: InStream;
TempBlob: Codeunit "Temp Blob";
TypeHelper: Codeunit "Type Helper";
InStream: InStream;
Faultcomm: text;
begin
TempExcelBuffer.Reset();
If TempExcelBuffer.get(RowNo, ColNo) then begin
CalcFields("Fault Comment Line");
"Fault Comment Line".CreateInStream(InStream, TEXTENCODING::UTF8);
end;
end;