Hey,
I am reading a fetching data from excel and dumping in NAV table using Automation variable.
The issue is NAV is reading incorrect time value from Excel.
Below is example of my code:
-------------------------------------------------Code----------------------------------------------------
FileName := 'D:\GRN_Today.xlsx';
CLEAR(ExcelApp);
CLEAR(ExcelWorkSheet);
CLEAR(ExcelWrkbook);
i := 0;
IF NOT CREATE(ExcelApp,TRUE,TRUE) THEN
ERROR('Error');
ExcelWrkbook := ExcelApp.Workbooks.Open(FileName);
ExcelWorkSheet := ExcelWrkbook.ActiveSheet;
i := 2;
REPEAT
PODate := FORMAT(ExcelWorkSheet.Range('Q'+FORMAT(i)).Value); // PO Date
DeliveredTime := FORMAT(ExcelWorkSheet.Range('R'+FORMAT(i)).Value); // Delivered Time
CreatedTime := FORMAT(ExcelWorkSheet.Range('S'+FORMAT(i)).Value); // Created Time
//MESSAGE('PO Date: '+PODate);
MESSAGE('Del Time: '+DeliveredTime);
MESSAGE('CreatedTime: '+CreatedTime);
i+=1;
UNTIL FORMAT(ExcelWorkSheet.Range('A'+FORMAT(i)).Value) = '';
ExcelWrkbook.Close;
ExcelApp.Quit;
CLEAR(ExcelWorkSheet);
CLEAR(ExcelWrkbook);
CLEAR(ExcelApp);
---------------------------------------------------Code--------------------------------------------------
The variables 'ExcelWorkSheet', 'ExcelWrkbook' and 'ExcelApp' are office automation variables
The variables 'DeliveredTime', 'CreatedTime' and 'PODate' are text variables.
I've even tried changing the format in excel, but all in vain.
The output for time value is
1
---------------------------
Microsoft Dynamics NAV Classic
---------------------------
Del Time: 42,816.705555555556
---------------------------
OK
---------------------------
2
---------------------------
Microsoft Dynamics NAV Classic
---------------------------
CreatedTime: 0.41175925925925921
---------------------------
OK
---------------------------
even though the value in excel is time : 09:52:56
I've found one link but that seems only to be a workaround but doesn't looks like a solution.
https://dynamicsuser.net/nav/f/developers/8625/importing-a-time-field-from-excel
Please let me know, if anybody have solved such issue.
*This post is locked for comments