Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Import file on network in Batch job

$
0
0

Hi all,

Can anyone please help me out from this issue. i m not able to read csv file data while scheduling that batch job.

i have schedule batch job through class, in that run method i have create code for reading csv file from path and inserting data into table.

below is the code for creating the RunbaseBatch job.

#File
IO iO;
CustAccount custAccount;
Name        custname;
FilenameOpen filename = @"C:\test\File1.csv";//To assign file name
Container record;
boolean first = true;
Table1 table1;
;
iO = new CommaTextIo(filename,'R');
if (! iO || iO.status() != IO_Status::Ok)
{
  throw error("@SYS19358");
}
while (iO.status() == IO_Status::Ok)
{
  record = iO.read();// To read file
  if (record)
  {
    if (first) //To skip header
    {
      first = false;
    }
    else
    {
      table1.Name = conpeek(record, 1);//To peek record
      table1.CustAccount = conpeek(record, 2);
      table1.insert();
      info(strfmt('%1--%2',custAccount,custname));
    }
  }
}

I m not able to read data from csv file from this line

iO = new CommaTextIo(filename,'R');

If i have run only for getting the list of csv file then it's giving me the all csv file from the folder.


Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>