Calling CSV file through X++ in ax 2012


FileIOPermission permission;
container readCon, _returnstatus, _dimensionColumnValue, _dimensionColumnName;
int cnt, numLines;
TextIO textIO;
textBuffer tb = new textBuffer();
CommaIo csvFile;
str _branch, _division, _cc, _equipment, _empl, _lc, _custVendID;

RecId _productID;
str _catCode;

int _counter;


permission = new fileIOpermission(_fileName,#io_read);

textIO = new TextIO(_fileName,#io_read);
if (!textIO)
throw error(“Error reading provided CSV file”);

tb.fromFile(_fileName);//File name with Path …
numLines = tb.numLines();
csvFile = new CommaIo(_fileName, ‘r’);
csvFile.inFieldDelimiter(” “); // Delimiter…

if (csvFile)//Checking for csv file.
readCon =;//reading the file.
readCon = str2Con(tb.nextToken(true));






One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s