local procedure ReadExcelSheet()
var
FileMgt: Codeunit "File Management";
IStream: InStream;
FromFile: Text[100];
begin
UploadIntoStream(UploadExcelMsg, '', '', FromFile, IStream);
if FromFile <> '' then begin
FileName := FileMgt.GetFileName(FromFile);
SheetName := TempExcelBuffer.SelectSheetsNameStream(IStream);
end else
Error(NoFileFoundMsg);
TempExcelBuffer.Reset();
TempExcelBuffer.DeleteAll();
TempExcelBuffer.OpenBookStream(IStream, SheetName);
TempExcelBuffer.ReadSheet();
end;
local procedure ImportExcelData()
var
SOImportBuffer: Record Recruitment;
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();
Evaluate(SOImportBuffer.Title, Rec.Title);
SOImportBuffer."Line No." := LineNo;
Evaluate(SOImportBuffer."Title", GetValueAtCell(RowNo, 1));
Evaluate(SOImportBuffer."Name as per(Legal)", GetValueAtCell(RowNo, 2));
Evaluate(SOImportBuffer."Email", GetValueAtCell(RowNo, 3));
Evaluate(SOImportBuffer."Date of Birth", GetValueAtCell(RowNo, 4));
Evaluate(SOImportBuffer."Gender", GetValueAtCell(RowNo, 5));
Evaluate(SOImportBuffer."Phone number", GetValueAtCell(RowNo, 6));
Evaluate(SOImportBuffer."Institute Name", GetValueAtCell(RowNo, 7));
Evaluate(SOImportBuffer."Qualification", GetValueAtCell(RowNo, 8));
Evaluate(SOImportBuffer."Course name", GetValueAtCell(RowNo, 9));
Evaluate(SOImportBuffer."YearofPassing", GetValueAtCell(RowNo, 10));
Evaluate(SOImportBuffer."Specialization", GetValueAtCell(RowNo, 11));
Evaluate(SOImportBuffer."Are you pursuing or have already completed your Post graduate degree", GetValueAtCell(RowNo, 12));
Evaluate(SOImportBuffer."If Other , Please name your College", GetValueAtCell(RowNo, 13));
Evaluate(SOImportBuffer."Address", GetValueAtCell(RowNo, 14));
Evaluate(SOImportBuffer."Country", GetValueAtCell(RowNo, 15));
Evaluate(SOImportBuffer."state", GetValueAtCell(RowNo, 16));
Evaluate(SOImportBuffer."City", GetValueAtCell(RowNo, 17));
Evaluate(SOImportBuffer."Zip Postal Code", GetValueAtCell(RowNo, 18));
Evaluate(SOImportBuffer."UploadResume", GetValueAtCell(RowNo, 19));
Evaluate(SOImportBuffer."Candidate Photo", GetValueAtCell(RowNo, 20));
Evaluate(SOImportBuffer."Previous Work Experience, If any Specify", GetValueAtCell(RowNo, 21));
Evaluate(SOImportBuffer."Work Designation", GetValueAtCell(RowNo, 22));
Evaluate(SOImportBuffer."WorkDuration from", GetValueAtCell(RowNo, 23));
Evaluate(SOImportBuffer."WorkDuration To", GetValueAtCell(RowNo, 24));
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;