thank for reply, now only customer Account is not populating in LegerJournalTrans Table, all my other fields are populating correctly..
my update Code is following ,one thing more i am inserting new records..
str _Date1,_debitCredit1,_demnsions1,_Descriptions,instNum;
str COMVariant2Str(COMVariant _cv, int _decimals = 0, int _characters = 0, int _separator1 = 0, int _separator2 = 0)
{
switch (_cv.variantType())
{
case (COMVariantType::VT_BSTR):
return _cv.bStr();
case (COMVariantType::VT_R4):
return num2str(_cv.float(),_characters,_decimals,_separator1,_separator2);
case (COMVariantType::VT_R8):
return num2str(_cv.double(),_characters,_decimals,_separator1,_separator2);
case (COMVariantType::VT_DECIMAL):
return num2str(_cv.decimal(),_characters,_decimals,_separator1,_separator2);
case (COMVariantType::VT_DATE):
return date2str(_cv.date(),123,2,1,2,1,4);
case (COMVariantType::VT_EMPTY):
return "";
default:
throw error(strfmt("@SYS26908", _cv.variantType()));
}
return "";
}
;
//Prompt to import excel
_dialog = new Dialog("Please select the file to load");
_dialog.addText("Select file:");
_file = _dialog.addField(ExtendedTypeStr("FilenameOpen"));
_dialog.run();
if (_dialog.closedOK())
{
application = SysExcelApplication::construct();
workbooks = application.workbooks();
//specify the file path that you want to read
filename =_file.value();//'C:\\Insert\\insertMunsif.xlsx'; //ExcelSheet File Name
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error('File cannot be opened');
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1); //Here 1 is the worksheet Number
cells = worksheet.cells();
do
{
row++;
instNum=cells.item(row,6).value().bStr();
AmountdebitCur=cells.item(Row,7).value().double();
_Date = cells.item(row, 8).value().date();
//_Date=str2Date(_Date1,123);
_demnsions1=cells.item(Row, 9).value().bStr();//cells.item(row,9).value().bStr();
dim64=str2IntOk(_demnsions1);
// info(_debitCredit1);
_Descriptions=cells.item(row,10).value().bStr();
//info(_Descriptions);
//TOI_ImportExcelForLegerJournalTrans.TransDate=_Date;
ledgerjournalTrans.TransDate=_Date;
LedgerJournalTrans.LedgerDimension=dim64;
ledgerjournalTrans.txt=_Descriptions;
ledgerjournalTrans.InstNumber=instNum;
ledgerjournalTrans.AmountCurCredit=AmountdebitCur;
//TOI_ImportExcelForLegerJournalTrans.Amount=_DebitCredit;
ledgerjournalTrans.insert();
//TOI_ImportExcelForLegerJournalTrans.insert();
type = cells.item(row+1, 1).value().variantType();