Upload .csv file through job in ax 2012
static void Atul_test(Args _args)
{
CommaIO csvFile;
container readCon, ledgerDimension;
counter icount,inserted;
Dialog dialog;
DialogField dfFileName, dlgJournalNum, JVNumber;
FileName fileName;
Struct struct;
str 50 jid;
;
inserted =0;
#File
dialog = new Dialog("Pick the file");
dfFileName = dialog.addField(extendedTypeStr(FilenameOpen));
dialog.filenameLookupFilter(["All files", #AllFiles]);
if(dialog.run())
{
fileName = dfFileName.value();
}
csvFile = new CommaIO(fileName, 'r');
if(csvFile)
{
ttsBegin;
while (csvFile.status() == IO_Status::OK)
{
readCon = csvFile.read();
if(readCon)
{
// write your code, which data you want to upload from csv file.
icount++;
inserted++;
}
}
ttsCommit;
}
info(strfmt("%1 records Updated out of %2",inserted,icount));
}
static void Atul_test(Args _args)
{
CommaIO csvFile;
container readCon, ledgerDimension;
counter icount,inserted;
Dialog dialog;
DialogField dfFileName, dlgJournalNum, JVNumber;
FileName fileName;
Struct struct;
str 50 jid;
;
inserted =0;
#File
dialog = new Dialog("Pick the file");
dfFileName = dialog.addField(extendedTypeStr(FilenameOpen));
dialog.filenameLookupFilter(["All files", #AllFiles]);
if(dialog.run())
{
fileName = dfFileName.value();
}
csvFile = new CommaIO(fileName, 'r');
if(csvFile)
{
ttsBegin;
while (csvFile.status() == IO_Status::OK)
{
readCon = csvFile.read();
if(readCon)
{
// write your code, which data you want to upload from csv file.
icount++;
inserted++;
}
}
ttsCommit;
}
info(strfmt("%1 records Updated out of %2",inserted,icount));
}
Thank you!
No comments:
Post a Comment