Hello everyone,
The below code inserts the data from excel to InventSerial table but i want to update InventSerial table if any difference is there between the InventSerial table and excel data.
Thank You
public void importExcel(Args _args)
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
int row = 1;
InventSerial inventSerial;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
try
{
workbooks.open(fileNameOpen);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
do
{
row++;
inventSerial.InventSerialId = cells.item(row, 1).value().bStr();
inventSerial.ItemId = cells.item(row, 2).value().bStr();
inventSerial.ProdDate = cells.item(row, 3).value().date();
inventSerial.RFIDTagStatus();
//info(strfmt('%1 - %2', itemId, name));
type = cells.item(row+1, 1).value().variantType();
inventSerial.insert();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
}