Today I come across a scenario where, I have to read data from csv file.
Reading data from csv file is very easy with IO operation. For example I have csv file with following student first name and last name which I have to migrate into custom ax table.
Custom Ax table.
Following a simple code snippet which read csv file and insert data into custom data
static void Job9(Args _args)
FilenameOpen filename = “c:\\StudentInfo.csv”;//To assign file name
boolean first = true;
iO = new CommaTextIo(filename,#IO_Read);
if (! iO || iO.status() != IO_Status::Ok)
while (iO.status() == IO_Status::Ok)
record = iO.read();// To read file
if (first) //To skip header
first = false;
FirstName = conpeek(record, 1);//To peek record
LastName = conpeek(record, 2);
After running the ax job, I found following data into Ax table.
If you saw, first row of csv is missing in table. The reason for that above code snippet consider first row as header so it did not require to insert it.
One thing I missed, The reference, original code snippet is belongs to “Jitendra Kumar Singh”